Link to home
Start Free TrialLog in
Avatar of jasonkrueger
jasonkruegerFlag for United States of America

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
Avatar of jasonkrueger
jasonkrueger
Flag of United States of America image

ASKER

any help is appreciated
Avatar of aikimark
@jasonkrueger

I think your posting of code is hurting your description of your problem.

var
  FileName: string;
begin
  ....
  FileName := Query.FieldByName('FieldName').AsString + '.XML';
  ...
End;
ASKER CERTIFIED SOLUTION
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i went with the TStringList route. Thanks to everyone that took time to respond.