cancel
Showing results for 
Search instead for 
Did you mean: 

Add value in Array from FindAllChildren

ChandanD
Contributor

Add value in Array from FindAllChildren

Hello,

 

I want to add the values in array from FindAllChildren and then find the Maximum value from array and perform the action on the max value.

But I am unable to enter the value in array and get the max value.

 

Please help to add the value in array and fetch the values from array.

 

var AllSelectCID = IBCDesigner.HwndSource_Window.WindowDeviceVersionSelection.TabControlSWVersionSettings.FindAllChildren(Array("ClrClassName","WPFControlOrdinalNo"), Array("CellValuePresenter", "2"), 100)
    var max = []
    for (var SelectCID of AllSelectCID)
    {
      Visible_Index = SelectCID.DataContext.VisibleIndex
      Log.Message(Visible_Index)
      var max = Visible_Index[0]
    for (let i = 0; i < Visible_Index.length; ++i) {
  if (Visible_Index [i] > max) {
    max = Visible_Index [i];
  }
}
Log.Message(max);
    }
    Log.Message("The complete array is"+ max)
   Log.Message(max.length)

 

3 REPLIES 3
sonya_m
Community Manager

Re: Add value in Array from FindAllChildren

Thank you for your questions!

 

@Wamboo @tphillips @ApplePen @tristaanogre , can you take a look?🙂


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
tphillips
Community Leader

Re: Add value in Array from FindAllChildren

Hi

 

You're declaring max as an array on line 2, then you're redeclaring it as a regular variable on line 7. This is likely causing issues

You're also never appending to your max array. What is your intention with that array anyway?

 

Additionally, you're mixing up your use of 'let' and 'var', and you're never declaring Visible_Index.


--------------------
QA Systems Architect
ChandanD
Contributor

Re: Add value in Array from FindAllChildren

What I am trying to achieve is :

I want to click on Radio button. The list of radio button is updated as per selected software version. (Eg. SW version 1  has 3 radio button, SW version 2 has 2 radio buttons). I am unaware of the list. 

So, the logic I am using is to find the latest index from array and click on the radio button. 

Now, with FindAllChildren I am finding out the latest index. I want to add the index number in Array and then find the maximum value from array and click on the Radio button with max index number. 

 

So, how to add the index number into array.

New Here?
Join us and watch the welcome video:
Announcements