Forum Discussion

jeeejay's avatar
jeeejay
Contributor
13 years ago

Order of Project Variables

Hello,



I have several Project Variables defined in my TestComplete project. Towards the end of my script, I have this for loop:



for(i=0;i<Project["Variables"]["VariableCount"];i++)

{

   variableName = Project["Variables"]["GetVariableName"](i);

   // do something

}



I observed that order in which I get the variables is the same order in which the variables were added and not the way they are displayed in the Variables tab. That's understood but my problem is that I cannot drag variables to change their 'default' order nor can I insert a new variable at any particular point.



The only way I can achieve this is to delete all the variables below the one where I want to insert a new one and then re-create the deleted ones again and it is very inconvenient. Another workaround through code is to collect all the variables in an array and sort it - but that can be done only when I want them sorted alphabetically - and that's not the case every time.



It would be really nice to know if there is an easier way to change the order of the project variables currently.



- GJ

4 Replies

  • Hi Allen,



    Thanks for your reply. My requirement is very simple. I have one variable per 'checktype' declared in my project. I assign each of them a value based on the check outcome and towards the end prepare a comma delimited file which is used as an input for creating reports in Excel for each test run. It looks like:



    [CheckName],[CheckResult]

    CheckAddRecord,PASS

    CheckDeleteRecord,FAIL

    and so on ...



    My problem is that when I need to add a new variable for a new check for e.g. CheckUpdateRecord, it get's added at the end of the table whereas, I want to 'insert' it between CheckAddRecord and CheckDeleteRecord as having 'Update' after 'Delete' doesn't make sense.



    I hope I could put my point across.



    - GJ

  • Hi GJ,





    Thank you for the clarification. We have registered the suggestion to implement this feature in our database. Thank you.


  • Thanks for the response and considering this as a featrue request. I am hoping it is available soon. As of now, I am updating the .mds file to get my job done!



    - GJ