Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Joining Multiple Field Values?

I have a multi-select field that returns values in the following format when viewed from a crystal report:

K1

B2

L5

I would like the report to display the values in the following format separated by a comma:

K1,B2,L5

Another non-crystal forum provided me with the following formula (applied as formula to the field's Display String) which produced a crystal error: "String length is less than 0 or not an integer."

Formula:

Local StringVar inString := {multiselectfieldname};
Local StringVar outString := "";
Local NumberVar i;
Local NumberVar j;

i:=Instr(inString, "-");
While i >  0 Do
(
outString := outString + Left(inString, i-1);
j := Instr(inString,chr(10));
inString := Right (inString, len(inString)-j);
i := Instr(inString, "-");
if i > 0 Then
outString := outString + ",");
);
outString

Nubie question:

1. What do I need to do to fix this error and return the format described above?

Thanks for any assistance.

replied

I thought it is a multi valued parameter.

How about writing the formula like this?

replace({field},chr(10),",")

Regards,

Raghavendra

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question