Forum Discussion

Raghukatta's avatar
Raghukatta
Contributor
9 years ago

Get count of items and loop through items in Keyword scripts

Hi,

 

I am trying to get the count of variables in the toolbar and then loop through the items and click in keyword scipts.

But I am getting an error saying "An invalid value is specified for End Value. The value must be a numeric value

An invalid value is specified for End Value. The value must be a numeric value".
I created local variable as integers and assigned the item count it.

 

Set Variable Value PaymentItemCount [Local] Aliases.Ascend.SaleForm.PaymentsToolbar.get_Items().Count
For Loop Variables.j, 0, Variables.PaymentItemsCount, 1

Run Script Routine ToolbarItemsClick - clickDevxToolBarItem Aliases.Ascend.SaleForm.PaymentsToolbar, Aliases.Ascend.SaleForm.PaymentsToolbar.Items.Item_2(j).Key 

 

 

Thanks in advance

1 Reply

  • SumanthKotha's avatar
    SumanthKotha
    Occasional Contributor

    Use for loop like below

    For Loop Variables.j, 0, Variables.PaymentItemsCount - 1, 1

     

    Since your array starts from 0 you can navigate to Variables.PaymentItemCount -1 (if you have 3 items then Variables.PaymentItemCount = 3 and loop is j=0, j=1 and j=2)

     

    I hope it will solve your issue.