AnsweredAssumed Answered

Syntax of Script Arguments

Question asked by JohnMitchell on Jun 2, 2012
Latest reply on Jun 5, 2012 by JohnMitchell

I have a multi-file solution; three of these files (Activities.fmp12, Organisations.fmp12 & Persons.fmp12) call a script in Persons.fmp12 with a common list of arguments.

 

This syntax (option A) works from Organisations, Persons and its other table Staff:

...

#update current employer

Set Field [ Organisations::gCurrent_employeeID; selected employee Person::PersonID ]
Set Field [ Organisations::gCurrent_staffID; selected employee::StaffID ]
#call Skype or telephone
Set Field [ Organisations::gScriptArgs; "PersID = Organisations::gCurrent_employeeID ; StaffID = Organisations::gCurrent_staffID; Context = "Employee" " ]

Perform Script [ “perCall_person_Skype” from file: “Persons”; Parameter: Organisations::gScriptArgs ]

...

 

but from Activities the above syntax doesn't work, but the syntax below doesfrom Activities

...

Set Field [ Activities::gCurrent_persID; selected member Person::PersonID ]

Set Field [ Activities::gCurrent_staffID; selected member Staff::StaffID ]

Set Field [ Activities::gScriptArgs; "PersID = " & Activities::gCurrent_persID & " ; StaffID = " & Activities::gCurrent_staffID & " ; Context = "Member" " ]

Commit Records/Requests
Perform Script
[ “perCall_person_Skype” from file: “Persons”; Parameter: Activities::gScriptArgs ]

...

 

Here is the common script in persons:

Persons: perCall_person_Skype

#1 June 2012

#select a telephone contact for a person and Skype

#scriptArgs: PersID, StaffID, Context: either as Employee - 3 modes "Member", "Employee", "Staff" or individual "Person"

Allow User Abort [ Off ]

Set Error Capture [ On ]

Set Field [ Persons::gCurrent_personID; getParam ( "PersID" ) ]

Perform Script [ “Set_choice_null” ]

Go to Related Record [ From table: “current Person”; Using layout: “Contact employee” (Persons) ] [ Show only related records ]

Set Field [ Persons::gForm_header; "Contact " & getParam ( "Context" ) ]

If [ getParam ( "Context" ) "Person" ]

#CASE A: select the employment details
#set the selected Staff member
Set Field [ Persons::Selected_staffID; getParam ( "StaffID" ) ]

Go to Layout [ “Contact employee” (Persons) ]

Else

Go to Layout [ “Contact person” (Persons) ]

End If

...

 

Q1: Is Option A syntax correct? (it never gives an error while editing the script)

Q2: If the Organisations example is correct, why doesn't the Activities script work?

Outcomes