Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Aami
Contributor III
Contributor III

Using tmap to implement "not in" condition

I have a job where it extracts all the IDs from an API and these IDs are passed into another API to get further details. Now the requirement was to ignore some of the IDs from the above and the list was supposed to be dynamic.

Basically I needed something similar to "Not IN" condition of Sql. 

 

Solution: I stored the Ids in context value in format ID1 | ID2 | ID3 |ID4 and added below condition in tMap which essentially does the job.

!((String)globalMap.get("id")).matches(context.EXCLUDED_ID)

Labels (7)
2 Replies
Ganshyam
Creator II
Creator II

Hello,

 

Instead of matches make use of equals.

!((String)globalMap.get("id")).equals(context.EXCLUDED_ID)

 

Thanks

 

Aami
Contributor III
Contributor III
Author

Hi,

 

My excluded ID has a variable number of IDs and equals function can compare with only one ID. And this is the reason I'm using matches. It can compare any number of IDs stored as ID1|ID2|ID3|ID4|... in context.