cancel
Showing results for 
Search instead for 
Did you mean: 

Error - A string array is required here

former_member645084
Participant
0 Kudos
461

Hi

How to display selected values from Multi Value parameter in Report Header

This is parameter

ItmGroup@Select * from OITB

Trying below but it is giving error- A string array is required here

Thanks

MD1
Active Contributor
0 Kudos

steps for multiple group show/selection in crystal report..try it

former_member645084
Participant
0 Kudos

Hi Danish

I want to display Selected Item Groups in Report Header of Crystal Reports

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

DellSC
Active Contributor
0 Kudos

To show the selected values of any multi-value parameter, you would use a function like the following:

local NumberVar i;
local NumberVar itemCount := ubound({?MyParameter});
StringVar result;

if itemCount = 1 then
  result := {?MyParameter}
else
  for i := 1 to itemCount do
  (
    if i = 1 then
      result :={?MyParameter}[i]
    else
      result := result + ", " + {?MyParameter}[i];
  );
result

Since multi-value parameters are stored in an array, this will append them together with ", " between them.

-Dell

former_member645084
Participant
0 Kudos

Hi Dell

On below line it is giving error - a string is reqd here

result := {?ItmGroup@Select * from OITB}local NumberVar i;

local NumberVar itemCount := ubound({?ItmGroup@Select * from OITB});
StringVar result;


if itemCount = 1 then
  result := {?ItmGroup@Select * from OITB}
else
  for i := 1 to itemCount do
  (
    if i = 1 then
      result :={?ItmGroup@Select * from OITB}[i]
    else
      result := result + ", " + {?ItmGroup@Select * from OITB}[i];
  );
result
<br>
Secondly can u pls guide me how this token parameter works - ItmGroup@Select * from OITB

DellSC
Active Contributor
0 Kudos

Try taking out the "if...else" part of the formula (three lines above the "for" loop).

Since you have the parameter in this format, I'm going to assume that you're working with B1. I haven't worked much with B1, but I believe that after you publish your report to B1, this parameter name format tells B1 where to get the lookup data for the parameter list of values so that it will show the list for the user to select from.

-Dell

former_member645084
Participant
0 Kudos

Hi Dell

It is working . But is shows values as 1110.00 , 1210.00

I dont want .00 . it should display as only 1110,1210

local NumberVar i;
local NumberVar itemCount := ubound({?ItmGroup@Select * from OITB});
StringVar result;
for i := 1 to itemCount do
  (
    if i = 1 then
      result :=Cstr({?ItmGroup@Select * from OITB}[i])
    else
      result := result + ", " + Cstr({?ItmGroup@Select * from OITB}[i]);
  );
result

DellSC
Active Contributor
0 Kudos

This is because using CStr without any additional parameters gives you the default number format. So, you need to change your calls to CStr to format the number. It will look something like this:

Cstr({?ItmGroup@Select * from OITB}[i], 0, "", "")

The "0" tells it to have no decimal places, the first empty string tells it to not include a thousands separator, and the second empty string tells it to no have any decimal separator.

-Dell

MD1
Active Contributor
0 Kudos

my last reply for this..can you share our procedure/Query

former_member645084
Participant
0 Kudos

Hi

What u mean to say i should send u query

Thanks

MD1
Active Contributor
0 Kudos

please share the example for understanding your requirement

former_member645084
Participant
0 Kudos

Hi

I have this token parameter defined

ItmGroup@Select * from OITB. Suppose user select A0001 , A0005 from the list then i want to display these values in Report Header

Selected Values are - A0001 , A0005

I am tryng using Join in a formula , it gives error - A string array is required here

Thanks