ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
04-08-2016 11:57 AM
Greetings all,
I have a 2d array of strings with values one colum representing an item set or subset number and the other being quantity of item in its parent looking like:
1 2
1.1 3
1.1.1 5
1.1.2 4
1.2 4
1.11 2
2 1
I would like to produce a third colum that shows the total number of items overall (ie 2 of item 1 means 6 of item 1.1, 30 of 1.1.1, 24 of 1.1.2, 8 of 1.2, 4 of 1.11 and 1 of 2) Looking like:
1 2 2
1.1 3 6
1.1.1 5 30
1.1.2 4 24
1.2 4 8
1.11 2 4
2 1 1
I was curious as to if anyone had a suggestion as to best handle the telling LabVIEW how and what to multiply. I imagen a something clever can be done with for and wile loops, but I'm not seeing it.
Solved! Go to Solution.
04-08-2016 12:05 PM
So is this like a structured BOM with multiple sub assemblies? I'm just trying to understand your calculations.
04-08-2016 12:09 PM
04-08-2016 12:15 PM - edited 04-08-2016 12:19 PM
It is not clear how you calculate the third column from the first and second column. Where are the item values defined?
If you can operate on one line at a time, autoindex on a FOR loop to get one row/iteration. Use "spreadsheet string to array with a 1D integer array type and a period as delimiter to get an array of the integers contained in the first element. Apply your math using this array and the scanned second element. Are the values in the first element indices into a lookup table?
Now format the result back into a string and append to the 1D array from the autoindexing tunnel. Autoindex to get a 2D array containing three columns at the output tunnel.
04-08-2016 12:21 PM
04-08-2016 12:26 PM - edited 04-08-2016 12:27 PM
I think you are looking for something like this. I used the Match Regular Expression to find the last period nad then used that name to search in the variant for an attribute with that name. It it exists, then the total count that is stored in the variant is returned. Multiply and store in the variant.
04-08-2016 12:28 PM
Still pure gibberish to me. Where are the n# defined? E.g. where is n3 coming from in the third line of your example?
04-08-2016 12:34 PM
@altenbach wrote:Still pure gibberish to me. Where are the n# defined? E.g. where is n3 coming from in the third line of your example?
The way I understand the problem, 1.1 has 5 of 1.1.1. Since we need 3 of 1.1, we need a total of 5*3=15 of 1.1.1. Since each 1.1 has 4 of 1.1.2, we need 4*3=12 of 1.1.2 for every 1.1.
04-08-2016 12:34 PM
04-08-2016 12:36 PM