AnsweredAssumed Answered

Finding an email or creating a new email record

Question asked by tays01s on Apr 28, 2015
Latest reply on Apr 29, 2015 by philmodjunk

Title

Finding an email or creating a new email record

Post

I have 2 related tables: Users::__ID < Licenses::_UserID & Users::Lic_n - License::Lic_n

I copy an email request into Users::Email_in. I then want to run a script that checks to see if:

a. The email is already cited in Users::Email_get. If it is, it the record is displayed, if not, a new email record is created.

b. There is already a license corresponding to the 'Lic_n', if not (including if there wasn't even a user email record, then a new license is created.

I have used the script below:

Set Variable [ $EmailFind; Value:Users::Email_in ]
Set Variable [ $Lic_nFind; Value:Users::Lic_n ]
Enter Find Mode [ ]
Set Field [ Users::Email_get; "==" & Quote ($EmailFind) ]

Perform Find [ ]
If [ IsEmpty (Users::Email_get) ]

New Record/Request

Set Field [ Users::Email_get; $EmailFind ]

Perform Script [ “New License” ]

Go to Related Record [ From table: “Licenses”; Using layout: “Licenses” (Licenses) ] [ Show only related records; Match found set ]

Enter Find Mode [ ]
Set Field [ Licenses::Lic_n; "==" & Quote ($Lic_nFind) ]

Perform Find [ ]

Else If [ Licenses::__ID ]
Perform Script [ “New License” ]

Else

End If

What I find is that:

1. When I already have a LIcense, the script creates a new License record.

2. Conversely when I have a User::Email_get record already, but not the corresponding LIcense, the script fails to create a new license..

3. Lastly, 'No records match the find criteria', is there a way to get the script to just get on with creating a new record without the dialogue (I thought there was a checkbox, but haven't seen it).

Outcomes