| Author |
Message |
p0pcan
Newbie
Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
|

Topic: Spliting field into Array and then displaying Posted: 15 May 2013 at 6:20am |
|
I am having an issue with the split command and then displaying the info. My issue is when we enter an return order in our system we choose which product is being returned and the quantity. Then we ad a remark to the line item showing all the serial number so what I have is a field with serial numbers separated by commas like this: 123,456,789,321,654,987
What I want to do is split this info into an array and then display the info with the product number that the field is attached to like this: dmw799bl-123 dmw799bl-456 dmw799bl-789 etc etc.
When I am doing my display I am only seeing the last serial number in the list and I am not seeing all the ones before that.
So for my example above all I would see is dmw799bl-987, then the report goes onto the next product.
Could someone help me with what I am doing?
here is my code: stringVar array serials := split({remarks.remark-data},","); Local numberVar i; Local stringVar outputString := ""; For i:=1 to Count(serials)
do ( outputString := {oe_trailer.product-code} + "-" + serials; i = i +1; );
outputString;
Thanks
|
IP Logged |
|
|
|
p0pcan
Newbie
Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
|

Posted: 16 May 2013 at 3:01am |
|
Hello there, could anyone help me on this? i need to get this report working by tomorrow
Thanks
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 17 May 2013 at 11:23am |
|
you'll kick yourself if my solution is correct...
outputString := {oe_trailer.product-code} + "-" + serials;
HTH
|
IP Logged |
|
p0pcan
Newbie
Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
|

Posted: 17 May 2013 at 12:09pm |
|
I already have that line in there...or do you mean only use that line and get rid of everything else??
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 17 May 2013 at 12:11pm |
|
Sorry, I overwrote part. Replace the line with:
outputString := outputString + {oe_trailer.product-code} + "-" + serials[x];
I used x since i makes italics
|
IP Logged |
|
p0pcan
Newbie
Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
|

Posted: 22 May 2013 at 3:07am |
|
Thanks for the update. That worked to get the product-serialnumber beside each other
now the next question is:
Is there a way to take each one of those combos and put them in their own field?
Right now it looks like this in one field: DMW799W-987654321123654DMW799W-651981611681DMW799W-6416518948165DMW799W-8946158645321DMW799W-987613123186DMW799W-68421613554DMW799W-984186465186DMW799W-6139835168DMW799W-64516435135DMW799W-9865131815
I want it to look like this and in separate fields: DMW799W-987654321123654 DMW799W-651981611681 DMW799W-6416518948165 ect.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 22 May 2013 at 5:41am |
|
I don't know about their field...that tends to be problematic, but to put them on their own line, that's pretty easy.
just change:
outputString := outputString + {oe_trailer.product-code} + "-" + serials[x];
to:
outputString := outputString + CHRW(13)+CHRW(10)+{oe_trailer.product-code} + "-" + serials[x];
and the last change is when you display outputString:
mid(outputString, 3)...unless you don't mind the extra blank line at the beginning.
HTH
|
IP Logged |
|
|
|