String manipulation based on flow variable

Hello,

I have a String Manipulation node, where my goal is to append a modified column to the input table. As I’m using this to develop a component, I’m passing the appropriate column name to the String Manipulation node in the form of a string type flow variable (coming from a Column Selection Configuration node).

I’m having trouble using the flow variable value for specifying the column. I receive the desired results when I manually select the SMILES column:
correct

However I cannot set the flow variable $${Sapi_column}$$ to a similar expression enclosed in $ characters (would be something like join("api_endpoint/query=", $$${Sapi_column}$$$) ?) so that it is recognized as a valid column name. Does anyone have a solution or workaround?

Best,
Benjamin

Hi @bkovats,

double click on a column name or flow variable name to insert the name automatically. If you want to enter it by hand, then use one dollar sign to enclose column names and two dollar signs to enclose flow variable names. Don’t use triple dollar signs.

Best regards
Andrew

1 Like

Ah, I was about to write much the same as you @Andrew_Steel as I was thinking the same thing, but I just realised that in fact @bkovats wants to return the value of the column whose name is contained in the flow variable, so he is dynamically choosing the column value to be returned

I can’t see a syntax for doing this in String Manipulation (but happy to discover it if somebody knows it!)

This can however be done with a column expression node as follows:

join(“api_endpoint/query=”,column(variable(“api_column”)))

3 Likes

Hi @bkovats,
I think you should use a String Manipulation (Variable) and create an expression for String Manipulation node


here an example for you
best
sajjad
string manipulation(variable).knwf (14.4 KB)

5 Likes

@takbb @Sajjadmosaheb many thanks for the solutions, both work perfectly!
Best,
Benjamin

2 Likes

Hi @bkovats , glad they both work. While using the Column Expressions is possibly simpler to write, if you have a large data set, I would expect you’d find @Sajjadmosaheb 's solutions better performing as I believe Column Expressions are not as fast as String Manipulation. For a smaller dataset, though, it probably won’t make much difference.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.