AnsweredAssumed Answered

How to count the Get(FoundCount) in a loop of a script

Question asked by olivervollmer on May 30, 2017
Latest reply on May 30, 2017 by erolst

I don´t know how to solve this problem in my script:

I have a ContactTable in listview Layout. I choose some Contacts and store the pk of these contacts in a global field of my contact table.

Now i build a script, that goes to a new table and writes every PK from this virtuallist to a new record.
Before i write new record, i proof with a perform find in a loop script if this PK is in the table. If not, a new record for this PK.

So far so good....


Now i want to count all PK that were not write as new records. I want to store this count in a variable.

How can i solve this ? I am very happy about good tipps and techniques to get a best working solution. Thanks !!


Here is my script:


Set Variable [ $$pkFAV ; Value: CONTACTS::gSelectedContacts ]

Go to Layout [ “FAVORITES_contacts” (FAVORITES_contacts) ]

Show All Records

Set Variable [ $list ; Value: CONTACTS::gSelectedContacts ]

Set Variable [ $count ; Value: ValueCount ( $list ) ]

Perform Find [Restore]


  Set Variable [ $i ; Value: $i + 1 ]

  Set Variable [ $row ; Wert: HoleWert ( $list ; $i )  ]

  Constrain Found Set [Restore]

  If [ Get ( FoundCount ) = 0 ]

  Show All Records

  Go to Record/Request/Page [First]

  New Record/Request

  Set Field [ FAVORITES_contacts::pkCONTACTLIST ; $$pkFAV ]

  Set Field [ FAVORITES_contacts::pkCONTACT ; $row ]

  End (if)

  Exit loop if [ GetAsNumber ( $i ) ≥  GetAsNumber ( $count ) ]

End Loop