Method Community

 

loop thr grid

Last post 01-19-2015 9:11 AM by Method_Justin. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-15-2015 11:05 PM

    loop thr grid

    when looping through a grid how do I get the bigger record, I have a grid where we keep the hours for the equipment, I only whant to get the record with the most hours, how can I achieve that?

  • 01-16-2015 8:30 AM In reply to

    Re: loop thr grid

    Hi Marcelo,

    What if there are multiple records matching this condition? For example, if the highest number of hours for any record is 10, but there are 3 records that have 10 hours. What would you like to do in that situation?

    Let me know.

    - Justin

    Justin Henderiks
    Technical Sales Specialist
    Method Integration Inc.
    Toll Free: 1.888.925.6238
    Local and overseas: 416.847.0400
    Fax: 416.640.6027
    E-mail: j.henderiks@method.me
  • 01-16-2015 2:24 PM In reply to

    Re: loop thr grid

    That will never happen. it is a grid of work orders completed for the equipment, every work order will have more hours that the one before, the value i need will always be the last work order completed

  • 01-19-2015 9:11 AM In reply to

    Re: loop thr grid

    Answer

    Marcelo,

    I would recommend using two Action Results, one to keep track of the largest number and another to keep track of the RecordID for its record.

    Create the Action Result to keep track of the largest number and make it equal to 0 (create this before your Loop Through Grid action). In your Loop Through Grid, use a Conditional Statement to compare the value of hours (for the current record) with that Action Result. If it's larger than your Action Result, store that value of hours to that Action Result and store that record's RecordID to a second Action Result. By the end of the loop, your first AR should contain the highest number of hours from your grid, and your second AR should contain that record's RecordID.

    Hope this helps.

    - Justin

    Justin Henderiks
    Technical Sales Specialist
    Method Integration Inc.
    Toll Free: 1.888.925.6238
    Local and overseas: 416.847.0400
    Fax: 416.640.6027
    E-mail: j.henderiks@method.me
Page 1 of 1 (4 items)