Forum Discussion

Jainsoumya's avatar
Jainsoumya
Contributor
3 years ago

I want to save ppt with random name or string

npaisley I want save ppt file with random name . I have tried using data generator but its always taking the same value as mentioned in screenshot

So when I am running my test step 2nd type I am getting popup file alredy exist with same name 

How to set variable for random string values 

I am calling variable like this

 

  • Hi Jainsoumya!

     

    The data generator can create unique values, but only once. We are not able to get unique data from the data generator at runtime.

     

    I agree with Marsha_R, one solution would be to use the the aqDateTime object to populate a variable with the current time and use this as your filename. 

     

    In the test below I have created a Persistent Project Variable in the String type. In our test, we fill this var out with a Set Variable step to populate the variable with the current time, with the second Set Variable step we are formatting the string to fit the Windows file naming conventions. Afterwards we are passing this variable into the save dialog.

     

     

    Note that I am using the 'Code Expression' mode for the values on these steps.

     

    I hope this helps!

  • Hi Jainsoumya!

     

    The data generator can create unique values, but only once. We are not able to get unique data from the data generator at runtime.

     

    I agree with Marsha_R, one solution would be to use the the aqDateTime object to populate a variable with the current time and use this as your filename. 

     

    In the test below I have created a Persistent Project Variable in the String type. In our test, we fill this var out with a Set Variable step to populate the variable with the current time, with the second Set Variable step we are formatting the string to fit the Windows file naming conventions. Afterwards we are passing this variable into the save dialog.

     

     

    Note that I am using the 'Code Expression' mode for the values on these steps.

     

    I hope this helps!

  • Thanks for letting us know this worked and accomplished what you are looking for!

     

    Happy Testing!

  • npaisley Marsha_R 

     

    Hi,

     

    Everytime my test script is taking same value for Var1

    , its not getting changed as per current time and date

     

    • Marsha_R's avatar
      Marsha_R
      Moderator

      Can you show us the two Set Variable lines in the log (so we can see the variable names)

      and also the whole code expression for the aqConvert?  Thanks.