I have a DataTable like following:
[ 1 ]… [Tomato Juice]
[ 1 ]… [Juicy Pear Juice]
[ 2 ]… [Golden Apple Juice]
[ ] … [with Honey]
[ 1 ] … [Grape Juice]
What I need to do is, get the item name as the Dictionary key, and get the Qty as its value.
What’s making this difficult for me is, as you can see, “Golden Apple Juice with Honey” is one string taking up 2 rows. You can tell the previous item name is taking up the current row by looking at the qty of the current row. If the current row is empty, you can assume that the item name needs to be concatenated from the previous one.
The result should look something like:
<key, value>dict = <“Tomato Juice”, 1>
<key, value>dict = <“Juicy Pear Juice”, 1>
<key, value>dict = <“Golden Apple Juice with Honey”, 2>
<key, value>dict = <“Grape Juice”, 1>
How could I do this? By the way, the item name can take up more than 2 rows. It can be 3 rows, 4 rows etc. The only way to know is that the Qty value will be empty for those rows.