cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically used project variables

SOLVED
Highlighted
New Contributor

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 depending on parametrization

Something like:

Aliases.ApplicationName.FormName.VCLObject(Edit) := Project.Variables.VarTest

( where Edit = EditName + Index ; and VarTest = VariableName + Index)

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Dynamically used project variables

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?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

2 REPLIES 2
Highlighted
Community Hero

Re: Dynamically used project variables

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?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

Highlighted
New Contributor

Re: Dynamically used project variables

Thank you very much @AlexKaras 

I tried evaluate before ... and it didn't work Smiley Happy

obviously cause I missed quotation marks for 'Project.Variables.VarTest'

 

Thanks again