jasonkrueger
asked on
Weird Delphi variable question
I have a question about whether or not an idea I have for making some code dynamic is actually possible.
In my code I'm building a filename by piecing together elements I receive back from a SQL query. The query would return a 'variable name' which would match up to an actual variable in my code. Can I somehow access the value of the REAL variable based on what name is returned from the query?
Example:
gsDCN := '123456789';
sReturnedValue := 'gsDCN'; //would actually be returned from SQL query
sOutputString := <value from the variable named in sReturnValue> + '.XML';
Is this possible? Maybe another method to accomplish this?
Thanks for any time spent on this.
Jason
In my code I'm building a filename by piecing together elements I receive back from a SQL query. The query would return a 'variable name' which would match up to an actual variable in my code. Can I somehow access the value of the REAL variable based on what name is returned from the query?
Example:
gsDCN := '123456789';
sReturnedValue := 'gsDCN'; //would actually be returned from SQL query
sOutputString := <value from the variable named in sReturnValue> + '.XML';
Is this possible? Maybe another method to accomplish this?
Thanks for any time spent on this.
Jason
@jasonkrueger
I think your posting of code is hurting your description of your problem.
I think your posting of code is hurting your description of your problem.
var
FileName: string;
begin
....
FileName := Query.FieldByName('FieldNa
...
End;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i went with the TStringList route. Thanks to everyone that took time to respond.
ASKER