on 10-16-2008 2:23 PM
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.
You mean multi select parameter field? if so then try this
join({?Parameter},",")
If not then try this
create a formula like
@Evaluate:
whileprintingrecords;
stringvar str;
str:=str+{field};
Place this formula in detail section and now create one more formula like
@Display:
whileprintingrecords;
stringvar str;
place this in footer section.
Regards,
Raghavendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Raghavendra for responding.
Without any formulas, the current report prints:
F1
K4
L6
I had already tried your first suggestion (join,","); but I get an error "A string array is required here" when I attempted to compile the formula.
When I attempted your second suggestion (evaluate/Display formulas) I observed the following:
The first record returned the first value in the list (i.e., F1), but not the remaining values separated by commas (i.e., F1,K4,L6). All subsequent records returned the same value (F1), despite the fact that subsequent records had different initial values (e.g., J5, U9, R4) than the first record's initial value (F1).
Again thanks, any help would be greatly appreciated!
I ammeded another solution in the archive.
With no formulas, the report prints:
F1
K4
With the following formula I get the report results:
F1
K4,F1
K4
Formula:
Whileprintingrecords;
stringVar i:={parameter};
stringVar i;
i:=i+", "+{parameter};
Can I fix my problem by amending the above code?
Thanks very much.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.