Forum Discussion

Emilija's avatar
Emilija
Occasional Contributor
5 years ago

Dynamically used project variables

Hi everyone, I am using Delphi application ... Is it posible to use project based variables, dynamically in scripts ??? I want to fill edits in the application with defined project scope variables...
  • AlexKaras's avatar
    5 years ago

    Hi,

     

    Yes, this is possible.

    If I got your question right, then you should use eval() or evaluate() function whatever exists for the scripting language you are using in your test project.

    E.g.:

    var strEdit = 'Edit';

    var strVarName = 'VarTest';

    for (var i = 1; i <= 10; i++)

    {

      Aliases.ApplicationName.FormName.VCLObject(evaluate(strEdit + i)) := evaluate('Project.Variables.VarTest' + i);

    }

     

    evaluate(strEdit + i) will resolve to 'Edit1', 'Edit2', ...

    evaluate('Project.Variables.VarTest' + i) will resolve to the value of Project.Variables.VarTest1, Project.Variables.VarTest2, ...

     

    Did I get your question right?