6 Replies Latest reply on Aug 19, 2009 6:48 AM by ninja

    Searching multiple found records for a field value....loop required?

    timothy2k

      Title

      Searching multiple found records for a field value....loop required?

      Post

      I have a script where one section searches a table for a records that match a certain record id.

       

      Once I find matching records, I want to check if any of them have a value of "X" in a different field.

       

      If any of them have the value "X", alert the user and exit, if none have it, do various other things.

       

      Does this require a loop that checks each record? OR is there a faster/simpler method?

       

      I was trying to use:

       

      Set Error Capture [On]

      Go to layout ["Quote Item"(QuoteItem)]

      Enter find mode[]

      Set Field[QuoteItem::quote_id;$record_id_variable]

      Perform Find[]

      If [(Get(FoundCount) > 0) and (QuoteItem::quote_item_status="X")]

         Go to layout [$layout_name]

         Show custom dialog ["Note"; "This quote item is already on a Purchase Order"]

         Exit Script[] 

       

       

      This seems to only search the first record, which make sense.I just wasn't sure of the most efficient approach to find any record with that value.

       

      Thanks.