I assume that when you create a new order, you enter the Company ID into the new Order table's record, either scripted (preferred) or manually.
You need a relationship, from that layout's Orders table occurrence, based on that Order::CompanyID to a new table occurrence of the Locations table, targetting its CompanyID.
Create a Value List, using values from a field, the above relationship, show the Location field.
Lower down, use the option, Include only related values, Starting from: Orders
I tried this before posting and it did not display any values. Here are a few more details...
CompanyID (relationship with CompanyID from Company Table)
I have a Company Layout. On it there is a Button (New Order) that uses a script (Go to Layout 'Order' and then New Item).
So...what am I missing.
As Fenton suggested, you need a CompanyID field in the OrderTable with a relationship from it to your Company table and then a link from this table occurrence to your Company Location table. You also need to specify that the Location field data for the value list be drawn from this new table occurrence--not the original table occurrence.
If "table occurrence" is a new term, you may want to read this article: Tutorial: What are Table Occurrences?
I gave this a try. I am missing something. Do you have an example that you can post?
OK. I have it working now. This was a little different approach than I was thinking. I guess I just have to get my head around how to do things the Filemaker way.
Thanks for you help on this. Much appreciated.
Every relationship reference in FileMaker evaluates from the perspective of the current record of the current table occurrence. Depending on context, that will be the table occurrence listed in Show Records From in Layout setup or the table occurrence listed in Show Records From in Portal setup.