1 Reply Latest reply on Jan 19, 2011 10:06 AM by philmodjunk

    Field Relationships and Auto-enter



      Field Relationships and Auto-enter


      I want to create a field in a database for a contact ID number.  The database is a list of transactions, and I want the ID number to correspond to the email address.  For example, every time I enter a transaction by joeshmo@gmail.com, the ID number associated with that email address is entered in the contact ID field, but if I haven't entered his email address before, he is assigned a new ID.  Is there a way to do this automatically?  


        • 1. Re: Field Relationships and Auto-enter

          Presumably, you have a table with at least the ID number as an auto-entered serial number and also the email address. I'll call this table and a layout based on it, "Contacts".

          This script:

          Set Variable [$Email ; Value: TransactionsTable::Email ]
          Freeze Window
          Go To Layout [ Contacts (contacts)]
          Enter Find Mode[]
          Set Field [Contacts::Email ; $Email]
          Set Error Capture [on]
          Perform Find[]
          If [Get ( FoundCount ) = 0]
             New Record/Request
             Set Field [Contacts::Email ; $Email]
          End IF
          Set Variable [$ID ; Contacts::Contact ID]
          Go To Layout [original layout]
          Set Field [TransactionsTable::Contact ID ; $ID]

          You can set a script trigger using OnObjectExit on your Transactions::Email field to perform this script.