AnsweredAssumed Answered

Issue setting a global field from one layout to another with portal involved

Question asked by jbroderick57 on Oct 7, 2015
Latest reply on Dec 18, 2015 by jbroderick57



Apologies up front for a lengthy set up on what is probably a simple solution - perils of self-learning.


I have a file which acts as a work order system for repairs of small equipment, such as iPhones.


There are these tables involved in my question (there are more like Vendor, etc. but they aren't pertinent):





Items (Parts and Labor descriptions for repairs)

Line Items - portal is used on the Invoice layout - pretty standard


Each customer could have more than one device and so each invoice could also show a different device if the customer brings a device in for repair.


I created a portal on the Invoice layout for the Equipment to be shown (just two portal rows) - shows Equipment unique ID (FileMaker unique serial), Color, Equipment Type, Carrier, Serial number (actual).


I also created a Global field for Equipment Type to enable a drill down of the parts from the Items, based on the Equipment Type (iPhone 5S for example).


The sequence of creating the Invoice is - create Customer, create Equipment record related to Customer, Create Invoice related to Customer with specific piece of Equipment.  Each step is scripted from layout to layout  Customer>>>Equipment>>>Invoice


I created a script which creates a variable based on the Equipment Type from the Equipment table - (Equipment::Equipment Type). When the invoice is created, the Invoice::gEquipment Type global field is set on the Invoice layout. I used a global because I've seen filtering done for value lists using this method.


Here's what happens and my question.


Let's say there are two pieces of equipment for John Doe.  One is iPhone 5C and the other is iPad Air 2, in that order.


When I hit the Create Invoice button and the script creates the invoice record along with setting the global, it will always display the first equipment piece in the portal - iPhone 5C, even if the iPad Air 2 was the equipment piece selected.


Also, the global will show whatever description was in the equipment when the invoice was created but will change the same field in all of the invoice records.  Maybe I shouldn't use a global here and just filter it from the Equipment::Equipment Type showing in the portal row?


Sorry again for the long description.


What's the best way to accurately show the current selected equipment on the invoice while still keeping it related to the customer?

What is the best method to set a field (will probably use for a PatternCount style filter) for the value list drill down for Type to limit the parts to the correct parts for the type?