
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trigger Run If Java Condition - How to code not contains
Hello I am using this code for Trigger Run If to determine if the file format is .csv to run a component. ((String)globalMap.get("FileName")).contains(".csv")
How can I code for everything else? Is there a java code to check if Not Contains .csv?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
contains() returns a boolean type.
In you case, if the filename contains ".csv", the expression returns true.
If I understood you correctly, you want every other file than .csv, so all files, that do not contain ".csv"?
Simply type:
!((String)globalMap.get("FileName")).contains(".csv")
Notice the exclamation mark. It means "not".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
How does the file name come? Do you use a tFileList to iterate a folder? Can you please explain why you use the global available?
(String)globalMap.get("FileName")
Regards
Shong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Edith,
If you don't mind, could you share a snapshot of your job design which you are trying to achieve. It helps us to know the requirement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's a screenshot of the job. In the beginning of the job, I'm iterating a temp table that includes the FileName to the tRestClient. The FileName has the file format of .csv or .xls. If the FileName contains .csv, then it goes to tFileRowCount and prints the message in tJavaFlex. If the FileName contains something else other than .csv, then I only want to print the message.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thanks for sharing your job, it is clear now. To get the current value of FileName column, the expression is:
(String)globalMap.get("rowN.FileName")
rowN is the row identifier such as row1 before tFlowToIterate
The java code to check if Not Contains .csv is:
!((String)globalMap.get("rowN.FileName")).contains(".csv")
Regards
Shong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
contains() returns a boolean type.
In you case, if the filename contains ".csv", the expression returns true.
If I understood you correctly, you want every other file than .csv, so all files, that do not contain ".csv"?
Simply type:
!((String)globalMap.get("FileName")).contains(".csv")
Notice the exclamation mark. It means "not".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @Bernhard Gruber for your time and help!
