Building field names at run-time

jsp

New Member
Is there anyway to build field names at run time for an ASSIGN statement for example?

I have a table I use for reporting, that contains CHAR fields named Text-1, Text-2, etc.

I need to assign values for Text-1 to Text-50, but would rather not hard-code in all those field names and would like to place some logic in a loop.

Is there a way to do something like Text-<Counter field> and have it build the field names to access at run-time?


Thanks
 
If it's just a reporting table why not have a single text field with 50 extents. Then you can have code like:


do li_cntr = 1 to 50:
rpt_table.text_fld[li_cntr] = "some value".
end.



Just as a side point you should avoid using hyphen ('-') in table or field names as it can cause trouble with SQL connections to your database.
 
Top