I am new to Crystal Reports and am using version 8.0. I have a data field that can contain up to 30 characters of data. This data may consist of several part numbers separated by commas. Is there any way to extract these numbers individually for reporting?
If you have to do some checking against them, you'll likely want an array, or to do leverage the sort of individual parsing the following array construction does:
whileprintingrecords;
Stringvar MyParts := {MyTable.MyParts};
Global Stringvar array MyPartsArray;
For x = 1 to 15 do // maximum number of commas
(
if InStr(MyParts, "," > 0 then
MyPartsArray[X] := left({MyTable.MyParts},InStr(MyParts, "," -1);
MyParts := mid({MyTable.MyParts},InStr(MyParts, ","+1,30)
else
x = 16
);
(I didn't test the syntax and I'm tired, but this sample get you close).
Thanks for your help. This works for reporting. I do have another situation that may not be so easy to answer. I have two tables: one containing work orders and one containing purchase orders. The purchase order table has a text field that may contain a series of work order numbers (just like the parts number problem) that are separated by commas. Is there any way to extract those and join the work order table to the extracted information?
I agree! This is a user defined field and that is how they want to use it. I am not in a position to refuse (too new to the company). I am not sure how to handle this. Thanks for your input.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.