AnsweredAssumed Answered

Can someone please confirm my understanding of the following examples as it relates to "Set Field By Name" using the examples found in the Filemaker 15 Script Steps Reference?

Question asked by ezellkendrick on Dec 30, 2017
Latest reply on Jan 1, 2018 by bigtom

Can someone please confirm my understanding of the following examples as it relates to "Set Field By Name" using the examples found in the Filemaker 15 Script Steps Reference:

 

Example 1 Identifies the target field (National Statistics or World Statistics) based on geographical location, then enters a calculated value (the sum of all Grand Totals) in the target field.

Set Field by Name [If ( Customers::Country = "Japan" ; Customers::National Statistics ; Customers::World Statistics ); Sum ( Invoices::Grand Total )]

In Example 1, Is this stating that if "Japan" is in either or both Customers::National Statistics and Customers::World Statistics that Sum ( Invoices::Grand Total ) will be entered into one or both of those fields?

 

Example 2 Demonstrates when to use Set Field By Name instead of Set Field to simplify scripts. With Set Field, an If statement with multiple Else If steps is needed to determine which field on the Customers table to update with information from Credit Collection::Phone Number.

If [Credit Collection::Call Location = "Work"] Set Field [Customers::Work Phone; Credit Collection::Phone Number]

Else If [Credit Collection::Call Location = "Home" ] Set Field [Customers::Home Phone; Credit Collection::Phone Number]

Else If [Credit Collection::Call Location = "Mobile" ] Set Field [Customers::Mobile Phone; Credit Collection::Phone Number] End If

 

A single Set Field by Name script step can perform the same task #by using a calculation to determine the target field. Set Field by Name [GetFieldName ( Evaluate ( Credit Collection::Call Location & " Phone" ) ); Credit Collection::Phone Number]

 

In Example 2, Is this stating that, Evaluate ( Credit Collection::Call Location & " Phone" ) basically results in the contents of Credit Collection::Call Location (e.g., Work, Home or Mobile) being combined with "Phone" resulting in "Work Phone," "Home Phone" or Mobile Phone" and at that point any Field with "Work Phone" etc in its title (e.g., Customers::Work Phone) would be set with the contents of Credit Collection::Phone Number?

Outcomes