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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subscripting through a parameter with multiple values

Status
Not open for further replies.

uksub

Programmer
Jun 15, 2003
51
US
i'm trying to subscript through this multi-valued parameter {? company}

example:

local stringvar temp:="";
local numbervar i;

for i:=1 to count({?company}) do
(

if i=1 then temp:=temp & {?company} ;
if i > 1 then temp := temp & ", " & {?company} ;
);

temp

end of example.


but if get an error saying that "{?company}" must be a string and it is defined as a string. it seems like it does'nt know what type the parameter is.
 
Just use
-----------------------------
Join({?company}, ",")
-----------------------------

Or refer to elements in the {?company} array as
{?company}

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Join works great.

But if you ever need to loop through a multivalued parameter, be sure to subscript the parameter.

----------------------------------------------------------
for i:=1 to count({?company}) do
(

if i=1 then temp:=temp & {?company} ;
if i > 1 then temp := temp & ", " & {?company} ;
);
----------------------------------------------------------

 
The last sentence in my message should have been

Code:
{?company}[i]

I forgot that Tek-Tips interprets
Code:
[i]
as italics unless you use
Code:
around it.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
if i=1 then temp:=temp & {?company} ;

this line gets a syntax error.. "A number, currency, boolean, date... string is required here".

it does'nt recognize my multivalue stirng parameter "{?company} as being defined as a string.
 
i am using subscripting {?company} []. i'm losing the my brackets when tek-tips displays my message.
 
I just tested your formula and it worked perfectly, so perhaps you should double check that your parameter is in fact set as a string.

Also, when you write a post, if you are using as a subscript, just uncheck "Process TGML" and the will appear as you have entered it.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top