Is there a way to create a hash/lookup table in a Java edit variable node and make this table available to other nodes in the workflow ? Alternatively, it could also be two string arrays like Keys(key1,key2,key3,...) and Values(value1, value2, value3,...).
The input is a variable containing a list of coma-separated string values from which I would like to generate the lookup table.
There is no direct way to do this but I have needed similar behavior before and find that using just a branch in your workflow to create a look up table along with the Reference row and column filters gets the job done nicely.
Thank you for your feedback. May I ask you if you could give a bit more details about what you mean ?
Basically, I have a string workflow variable containing the value "2065,2068,2069" for instance (these are experiment IDs). What I would like to get is something like this:
2065 Serie1
2068 Serie2
2069 Serie3
So that when merged with the main data stream, rows containing the experiment ID 2065 will get tagged as Serie1, 2068 as Serie2, ...
I have tried to do that in a Java snippet, but I don't seem to find out how to generate the whole table.
Based on your first reply, I somehow managed to do it in a separate branch by generating two output array columns in a Java snippet, and then ungrouping them, which gave me the table shown above in my previous post. I can then join this table with my data stream, which gives me the expected assignment.
For those coming here searching for a way to calculate hash values for rows:
There is a node called Rank that does not calculate actual hashes.
What it does is sort your table …
… and then go through it line by line …
… assigning new integer values whenever it sees a new combination of values …
… while rows with the same value combinations share the same combination.
The integer-value-combination mapping is specific for the table you are operating on, so you cannot solve all problems solvable with row hashes but some.