G’dayI have a multi-valued field that contains a number of items, separated by the ë character. Here is an example of the contents of the multi-valued field called Lineitems:
“MUS-0-12 ë12oz bottle mustardë468 ë468 ë0 ë13.61 ë6369.48 ë55 ë0 ë10.0833ë”
“KET-0-12 ë12oz bottle ketchupë120 ë120 ë0 ë13.61 ë1633.2 ë55 ë0 ë7.99906ë”
“MUS-0-12 ë12oz bottle mustardë200 ë468 ë0 ë13.61 ë6369.48 ë55 ë0 ë10.0833ë”
The first part of the field is the SKU, the 2nd is the description, the 3rd is the # of cases.
What I want to do is: Anything that begins with the SKU of “MUS”, sum the # of cases. In this case my answer would be 668.
Here is the code I have so far but it’s giving me 0’s
Items := @Implode(@Middle(@Word(Lineitems;“ë”;1);0;2));
Cases := @Implode(@Middle(@Word(Lineitems;“ë”;3);0;“,”));
summedValues := “”;
@For(n := 1;
n <= @Elements(Items);
n := n + 1;
@If(Items[n] = “MUS”;@Set(summedValues;Cases);“0”));
summedValues
If I was to view the Items variable it would look like MUS KET MUS
And the Cases variable would look like 468 120 200
Hope that makes sense.
Thanks for any help
Kenny