Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In a tMap component, I do this :
"
(
!CAS1.ID.equals("101")
&&
!CAS1.ID.equals("102")
&&
!CAS1.ID.equals("110")
...
)
"
This code is OK but for me, this code is not "nice" and I search to make better this code.
I find something like this in MySQL :
select id from table where id IN ('a', 'b', ...)
It is possible to do something like this with Talend ?
Kind regards.
Hello,
You can achieve this goal by using tMySqlInput component with context value in your Where clause.
The syntax looks like "SELECT id FROM mytable WHERE id IN '"+context.myvariable + "'"
The best way to approach this is to build your SQL query, output it to the System.out and then test the String you see in a query analyzer. If it works there, it will work in your DB component.
Best regards
Sabrina
I think below condition using java contains method would be nicer (assuming comma is your separator).
! ( "," + "101,102,103,104,105,106" + "," ).contains( ("," + CAS1.ID + ",") )
You can easily expand your listOfValues "101,102,103,104,105,106" separated by a comma as you like.
Hi you can use regular expressions :
!CAS1.ID.matches("101|102|110")
Send me love and kudos