Forum Discussion

DavidRedmayne's avatar
DavidRedmayne
Occasional Contributor
8 years ago
Solved

Loop with incremental variable

I have test that loops around 50 times to examine a process under continuous use. The looping is no issue and has worked well on a couple of tests. However, I now need to increment data in a field that is required to be unique for every of the 50 'saves'.

 

I have used the project variable data table set to integer and populated the single column table with 50 integers, 54330, 54331 etc. However, when I run the script, I get a type mismatch error.

 

If I enter just one value in the variable with type as text and 54330 then the (first) loop runs. Going back to the data table and using type string, numeric only then I get the type mismatch message again.

 

The line of code is:

 

Aliases.browser.pageNeonCms2.formFormcancrecredit.panelColl.fieldsetTransaction.panel.Textboxslipnumber.SetText(Project.Variables.Slip_number);

 

Clearly, although it's a number that's required, it would seem to be in text format. So why won't data from the Variable Data set to string work?

 

Could I use an Array and For, Next type of thing directly in the JScript?

 

Thanks

 

David

  • Try wrapping your variable in a call to aqConvert.VarToStr. that should convert whatever value to a string for SetText

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Try wrapping your variable in a call to aqConvert.VarToStr. that should convert whatever value to a string for SetText
    • DavidRedmayne's avatar
      DavidRedmayne
      Occasional Contributor

      Hi Robert - thanks for this. I seem to have tried just about every combination of using aqConvert and keep getting errors like "unable to find the object VarToStr"

      with

      Aliases.browser.pageNeonCms2.formFormcancelcredit.panelCol1.fieldsetTransaction.panel.textboxTextboxslipnumber.VarToStr.SetText(Project.Variables.Slip_number);

       

      Or

       

      Aliases.browser.pageNeonCms2.formFormcancelcredit.panelCol1.fieldsetTransaction.panel.textboxTextboxslipnumber.SetText.VarToStr(Project.Variables.Slip_number);

      OR

      Aliases.browser.pageNeonCms2.formFormcancelcredit.panelCol1.fieldsetTransaction.panel.textboxTextboxslipnumber.VarToStr.SetText.aqConvert.VarToStr(Project.Variables.Slip_number);

      Or

      Aliases.browser.pageNeonCms2.formFormcancelcredit.panelCol1.fieldsetTransaction.panel.textboxTextboxslipnumber.VarToStr.SetText(aqConvert.Project.Variables.VarToStr.Slip_number);

       

      Driving me mad!! Any further suggestions were to put it :smileyhappy:

      Thanks

      David

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        See below

        Aliases.browser.pageNeonCms2.formFormcancrecredit.panelColl.fieldsetTransaction.panel.Textboxslipnumber.SetText(aqConvert.VarToStr(Project.Variables.Slip_number))