Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identify variables
Message
From
04/06/2007 23:23:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01230420
Message ID:
01230446
Views:
15
>I have an unknown set of variables that will be in scope in a function and will have a common prefix. How can I identify all of the variables and get their values (actually, all I need are the values)? I played around with using “save to” function but I feel like I’m missing something obvious.
>
>The vars will all have “chk_” as the prefix: chk_DCW, chk_SIR
>
>Thanks,

I have a very strong impression that the whole issue could - and should - be circumvented by some design change. While I don't know exactly what you need those many variables for, some options might include:
  • Have an array. Each element can replace a variable.
  • Have a string in memory. Each line might replace a variable, or you might use another convenient separator, such as a semicolon.

    Probably there are other ways, too, such as as XML, with which I have no experience. But perhaps you should tell a little more, where do those variables come from, what do you do with them, etc.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform