Skip to Content

how to use the FOR/NEXT loop and its parameters

Automation Testing question using CBTA:

In "Original Document No" in "Additional Data A" tab of VA01 that i needed to re-iterate using unique number every time i create Sales order

How do i use any command similar to For/Next loop to reiterate XYZZZZZYYY0001 to XYZZZZZYYY9999 for any future sales order creation for testing


anysf.png (8.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jun 25, 2020 at 11:05 AM

    You can use RANDOM token to generate RANDOM number every execution eg: %random%

    Thanks,

    Aj

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Ajay, first of all, thanks for your response. If i use Random token then there are possibilities of getting that particular random number may populate again. Is %counter will work? if so where should i place that %Counter% ..in parameter or in test script? Please advise

  • Posted on Jul 02, 2020 at 07:18 AM

    Hello Bhavik,

    You still need to initialize Counter right ? Atleast I do not see a case where Random number is repeated, you also prefix it with Date if you feel it might repeat.

    Thanks,

    Aj

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi AJ, i tried XYZZZZZYYY%random% and it work to get me 6 random number yet failed my test script due to my below challenge:

      first 10 alphabets of Original document number is fixed and last 4 digit can be random or with counter increment from 0001 to 9999. Please advise, how do i use %Random% for only last 4 digit (random usually gives 6 digit)

  • Posted on Jul 08, 2020 at 02:27 PM

    You can use trim functionality to trim only 4 characters from Random number.

    Thanks,

    Aj

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 16, 2020 at 01:47 PM

    Thank you very much Ajay ji,

    i used trim 4 char: %=right($random$,4)% and worked very well

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.