I’m trying to combine some data into one file. The issue is the plate barcode for some of these are long and others are string. When the file reader reads the longs in it reads them as double, and of course reads the strings as strings. This causes issues at the end of the loop.
What I’m trying to do is split away the plate barcode and if it is of type double convert it to long and then to type string. If I don’t do this then I get 7.77xxxxxE11 if I convert directly to string from double. If it comes in as type string I don’t want to do anything.
I have tried the traditional switches with no luck. My hunch is this could be done with a java if table node. I’m guessing there is some java which could say if column x is the go to port 0 if not then port 1.
Thanks @elsamuel@ipazin. I’m using csv reader in this case and I had tried to set up first a column splitter to split away the column in question then a second to split by type to modify but in that case I found the rowID’s were still there so I couldn’t use a empty table switch to control the path. Burned a couple of hours doing that I did figure out a way to do what I want but I know that there is probably a snippet of java code which can do it all in the java if table. I’ve attached a pic of what I have which does work. It’s just inefficent.
and why not just using Double To Int node with check to have Long values? If the column is there and a double, it will convert it. Otherwise it is ignored. Follow it with Number To String which should have same behavior.
If you really want to use Java IF (Table) node you can use following code: