One Star

Trigger another job, when tSystem output has certain text

Hi talend team,
I want to trigger a stored procedure, when I run in tSystems an external perl script, which finishes successfully.
This is the output of the perl script in the tSystem component:
Start loading data at: 2008-04-17 10:46:23
Preparing load of data in /path/to/file/file.TXT:

Records inserted: 672
Finished loading data at: 2008-04-17 10:46:24

So I used an If-Trigger connection and I tried this:
((String)globalMap.get("tSystem_1_OUTPUT")) =="Finished loading data"

But nothing happens ...
I guess you will suggest me to use regex, but I couldn't figure out how to use it.
5 REPLIES
One Star

Re: Trigger another job, when tSystem output has certain text

You can execute regex with:
((string)globalMap.get("tSystem_1_OUTPUT"))).matches("Finished loading data")

For more information:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
Hope this helps.
Bye
Volker
One Star

Re: Trigger another job, when tSystem output has certain text

Thanks Volker,
but I have no experience using regexp and I couldn't get it work. I added a screenshot of my job, where you can see the configuration of the if-trigger connection.
But I get the following error message, when I run this job:
Starte Job IMPORT_LPEX2_TO_DB am 09:58 18/04/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
string cannot be resolved to a type
at inpower.import_lpex2_to_db.IMPORT_LPEX2_TO_DB.tFileList_1Process(IMPORT_LPEX2_TO_DB.java:373)
at inpower.import_lpex2_to_db.IMPORT_LPEX2_TO_DB.runJobInTOS(IMPORT_LPEX2_TO_DB.java:1386)
at inpower.import_lpex2_to_db.IMPORT_LPEX2_TO_DB.main(IMPORT_LPEX2_TO_DB.java:1305)
Job IMPORT_LPEX2_TO_DB endet am 09:58 18/04/2008.

Any suggestions
One Star

Re: Trigger another job, when tSystem output has certain text

I think string should be String.
One Star

Re: Trigger another job, when tSystem output has certain text

Sorry. Yes, string should be String.
I'm not a "regex-master" for java (each implementation is a little bit different).
You have to take care about the following two things:
matches() matches the whole string. So you need something like: ".*Finished loading data.*"
And you have a multiline string. I don't know if there are any specialties for that.
Bye
Volker
One Star

Re: Trigger another job, when tSystem output has certain text

Thanks that helped.
Marko