Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter as Array of user added values 1

Status
Not open for further replies.

alectek

Programmer
Jul 9, 2003
68
0
0
US
Hi!
I am using Crystal XI with SQL server.
I need the report witch will show Client ID and Client info from the Client.db table and the registration date witch aren’t store anywhere.
Therefore, the parameter needs to be a combination of Client ID and the Date user will just type:
“Enter Client ID & Registration date in following format: 000000 - mm/dd/yyyy”
Record selection is: totext({Client.ID}) in (totext(Val({?Client ID & Registration date})))
Registration Date formula: Right({?Client ID & Registration date},10)
All this work very nice when we need show only one Client info with the Date.
How should I change the record Selection and the Formula to let user add multiple Clients.
Thanks a lot at advance.


Thanks.
Alec.
 
You can create an Excel spreadsheet and link it as an extra table in your report. Use SEARCH for details of how to do this.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Madawc, thank you for your advice, but I have to do it in parameter

Thanks.
Alec.
 
I used following code. There aren't any errors but it prints all the records from Client table.

local numbervar i = 1;
local numbervar ClntCount := {?Number of Clients to register};
local stringvar array myparam := ({?Client ID & Registration date}[1 to ClntCount]);

for i := 1 To ClntCount Do
(

totext({Client.ID},000000) in totext(Val(left(myparam,6)))

);


Thanks.
Alec.
 
Change it to:

local numbervar i = 1;
local numbervar ClntCount := {?Number of Clients to register};
local stringvar array myparam := ({?Client ID & Registration date}[1 to ClntCount]);
stringvar x;
for i := 1 To ClntCount Do
(
if totext({Client.ID},'000000') in totext(Val(left(myparam,6))) and
not(totext({Client.ID},'000000') in x) then //to add only distinct values to array
x := x + totext({Client.ID},'000000')+","
);
totext({Client.ID},'000000') in x

-LB
 
Lbass, thank you very much. Code looks very logical, but report returns zero records. I was thinking that the problem in the formatting and changed it. Still same result.
Any suggestions?

local numbervar i = 1;
local numbervar ClntCount := {?Number of Clients to register};
local stringvar array myparam := ({?Client ID & Registration date}[1 to ClntCount]);
stringvar x;
for i := 1 To ClntCount Do
(
if totext({Client.ID},0,"","") in totext(Val(left(myparam,6)),0,"","") and
not(totext({Client.ID},0,"","") in x) then
x := x + totext({Client.ID},0,"","")//+","
);
totext({Client.ID},0,"","") = x;


Thanks.
Alec.
 
Sorry, it was an error in last Post. Here is the right one, but the result of repor zero any way.

local numbervar i = 1;
local numbervar ClntCount := {?Number of Clients to register};
local stringvar array myparam := ({?Client ID & Registration date}[1 to ClntCount]);
stringvar x;
for i := 1 To ClntCount Do
(
if totext({Client.ID},0,"","") in totext(Val(left(myparam,6)),0,"","") and
not(totext({Client.ID},0,"","") in x) then
x := x + totext({Client.ID},0,"","")+","
);
totext({Client.ID},0,"","") in x;

Thanks.
Alec.
 
Sorry.

numbervar i = 1;
local numbervar ClntCount := {?Number of Clients to register};
local stringvar array myparam := ({?Client ID & Registration date}[1 to ClntCount]);
stringvar x;
for i := 1 To ClntCount Do
(
if totext({Client.ID},'000000') in totext(Val(left(myparam,6))[red],'000000'[/red]) and
not(totext({Client.ID},'000000') in x) then //to add only distinct values to array
x := x + totext({Client.ID},'000000')+","
);
totext({Client.ID},'000000') in x

-LB
 
Lbass, BRAVISIMO! It's working! Thank you.

Thanks.
Alec.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top