COlumn List start and Javascript node

Hi there,

I am banging my head on this. I have 12 columns and I need to loop through these columns and do some string manipulation (extract a string in the respective column rows), then append the extracted string into a new column.

So using Column List Loop node, I can select the columns to read, and end the loop with column append node adds the new column. The string manipulation part I need to write in the javascript node (as the string extraction is complex), but I cannot see how I pass the column name into the javascript node.

Can you help,



The use case is I am extracting an atom count value from a chemical structure represented as a .mol string, The string has the form;

  • id1234556 \n\n 30 32 0 0 0 0 0 1 v2000\n

so I need to extract from the above example the number 30 (this represents the atom count within the .mol file format), the identifiers I am using for the string are;

start position ‘\n\n’
end position v2000\n

I can then parse the numbers into an array to extract the diifferent values as needed.

Happy to consider any approach though or any suggestions.

Hi @stanage, It looks like you’ve figured out the Column List Loop nodes. The Column List Loop Start node creates a couple of useful variables. One of them is the “currentColumnName” variable, which of course holds the column name associated with the current iteration of the loop. This variable can be used in downstream nodes that need the current column name.

I’m not sure which “javascript” node you’re referring to (there is no node named “javascript”) but in any case I would probably use something like a column expressions node, or if you know Java, a Java Snippet node to extract the relevant data (probably the most efficient option). If the numbers are in fixed positions within the string you might consider the “Cell Splitter By Position” node. Just some possibilities. Good luck.

Thanks for the advice, indeed it is the Java snippet node not Javascript - doh !

1 Like

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