juvenile
28th August 2004, 09:11
Hai friends,
I have 8 extern variables called item1.desc,item2.desc to item8.desc.
these will be the column names in the report.I have to send these values at the time of running of report.
long counter
counter =1
Select *
from tiitm001
as set with 8 rows
selectdo
"item" & str$(counter) & ".desc" = tiitm001.dsca
counter = counter + 1
endselect
The above code is giving some errors?
Can we form variables at run time?
I can use array for this.But I want to do like above pls help
rgds,
juvenile
rameshr
28th August 2004, 16:23
u can do this with the help of expr.compile and s.expr$ functions. Declaring the variables extern is mandatory for using this functions.
code could be like
long expr
expr = expr.compile("item"&str$(counter)&".desc:= tiitm001.dsca")
s.expr$(expr) | will assign the value for the right counter
expr.free(expr)
juvenile
30th August 2004, 06:38
Hi Ramesh,
ramesh thanks for your excellent reply.Can I send these array to the report.In report do I need to create all the variables or one variable.
First of all am unable to create array variables in the report input fields.
help me
thanks in advance
rameshr
30th August 2004, 13:03
In reports arrays can be used by using depth in maintain input fields.
If this example u'll have to add all the variables to input fields individually.
jack786
30th August 2004, 13:43
Hi ramesh,
I am using array as u said.and I want to split the desc into 2 fields like
dsca(1;15) and dsca(15;30). But using array how to split am getting errors.
I cant write like this item.dsca(1)(1;15) and item.dsca(1)(15;30).
rgds,
Juvenile
mark_h
30th August 2004, 15:36
See this post (http://www.baanboard.com/baanboard/showthread.php?t=16337) for how to access string arrays. You would use something like item.dsca(x,y;z) where x is start character, y is array element and z is number of characters.
Mark
günther
30th August 2004, 16:31
>I have 8 extern variables called item1.desc,item2.desc to item8.desc.
Why that? Why don't you use item.desc(1) to item.desc(8) -- ONE VARIABLE (an array item.desc with 8 Elements)? Looping would have been much easier, Resetting e.g. set.mem(item,desc, ""), passing to reports and so on.