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!

errors in array and for loop

Status
Not open for further replies.

ub1234567

Programmer
Dec 4, 2008
69
US

hi everyone,

this is not same thread, this is my different problem.

stringvar a := "";
numbervar i;
numbervar b := array({?subcat - ProductSubcategoryID})
for i := 1 to count({?subcat - ProductSubcategoryID})
step 1
do
a := a & b
a;

above code given me error - number,currencr,datetime,string is expected here.

any help is appriciated

thanks.
 
YOu have not defined this properly

numbervar b := array({?subcat - ProductSubcategoryID})

this does not make sense

also you can not concatenate numbers and strings, you will have to convert number to a string first using totext()

if this ({?subcat - ProductSubcategoryID}) is an array of numbers then try

numbervar array b := ({?subcat - ProductSubcategoryID})

Ian

 
Making assumptions since you didn't specify -- you have a list of things that are numbers that you need to concatenate without the character mixed in. I have had similar needs when dealing with a GL number formatted as xxx-xxxx-xx-xx-xxxx or something like that... lol

numbervar array b :=
split({?subcat - ProductSubcategoryID},"-");
//assumes dash delimted, replace with whatever
for i := 1 to ubound(b)
a := a & b
a;

Is this what you were after?
Scotto the Unwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top