Skip to Content
0
Former Member
Jul 25, 2005 at 06:28 AM

Dynamic Variable names

7816 Views

Hi All,

Here is my fishy requirement.

I have tens of variables globally declared as g_line_01,g_line_02 and so on to g_line_99. (I can not change this declaration part 😔 as it used by other part of the programs.

Now I need to fillin data into these g_line_xx lines which will then print into a dataset.

Now my requirement is here:

Lines g_line_13 to g_line_17 should contain the customer address information, ie. Name1, Name2, Name3, Name4, Street, City, PO Box and Postal Code, country etc.

Now there exist a logic to group these fields and populate the lines from g_line_13 to g_line_17. The problem comes when one/some of the above said field/s is/are blank. That may result in one of the g_line_xx variable to be blank. I need to avoid this scenario. That means, if I see that g_line_15 is to be blank, then all the below line should come up by one line.

I was thinking can we have this done by dynamic variable names ?? ie. I use some string manupulation to prepare the variable name g_line_xx and can I have this in the assignment statement ?? Or is it impossible?