How to randomly pick and output a single number from a comma separated list of numbers given an attribute value?

I have a list of numbers in each row of a column-“prime number list”. To have a better understanding, image first row of this column is a string “2,3,4,7” and the second row has the string “11,13,17,19”.

There is another column-“range” that has values “1-10” and “11-20” in the corresponding first two rows.

What I want is to extract one number from the comma-separated list of numbers in the column “prime number list” GIVEN a matching string in the “range” column, let’s say “1-10”.

This is how it looks right now:

My end goal is to create a component that will have a drop-down list of ranges in its configuration and will output a single prime number from that range of numbers along with the mapped difficulty level. I want these two outputs as flow variables to be used in the next node(s).

Thank you for your time!

It would be a lot easier for potential “helpers” if you would upload your existing workflow and sample data.

2 Likes

Thanks @rfeigel for your quick response! I have made a few minor updates to the workflow and moved its copy to the public hub temporarily. Here is the access link:

See if this helps.You can create flow variables from the Table Manipulator output.

On second thought I’m not sure whether you want to generate a random number in the selected range or simply pick one from your table. This workflow does both. The original portion generates random numbers. The portion of the workflow in the box selects one of the predetermined numbers. You can pick.

Did the last workflow I posted work for you?

1 Like

I’ve added the number selector from the table version to the interactive view. I’ve also added Table Row to Variable nodes to both number selectors since you said you wanted to use variables downstream. Please let me know if this helps.

1 Like

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