- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 09:34 PM - edited ‎03-15-2023 09:36 PM
Hi,
I have a table Company(core_company) which has 2 fields Name(name,type : String) and Area(u_area, type : Choice). In Area there are 10 values(or more).
For example, when Area = Russia, there will be 3 Name(A,B,C); Area = Japan will have 3 Name(C,D,E)
I create a custom table called Test, which also has 2 fields, Location(u_choice, type : Choice) and Place (u_place, type : references).
In Location I connect to Choice Table (core_company) of Area and get the choice value of Area.
In Place I refer to the core_company table, and the Place field depends on Location.
I would like that when the value of Location changes, the value of Place( same Name (core_company)) appears only the value that matches Location. Is there a way to do it with Script ?.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 11:47 PM - edited ‎03-15-2023 11:51 PM
It can actually be done without code. I quickly added the new "Area" field on the Company table and created a new "Test" table with both "Location" and "Place" fields like you have.
Here are the Companies that have an Area selected:
And here's the new "Test" table, configured with the "Location" field pointing back to the "Area" choices on the "Company" table:
The trick is to configure the "Place" Reference field with the following setup:
1. set the "Use reference qualifier" field to "Advanced" and the "Reference qual" field to "javascript:'u_area=' + current.u_location" (you might have to switch to the "Advanced" view if not already)
2. add an attribute to the field (at the bottom of the form) which tells the system to send back the value of the "Location" field so it can be used in the Reference Qualifier
So now when you select a Location, only those matching Companies can be selected:
Make sure any field names I am using here match what you actually have in your instance and change accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2023 01:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2023 01:21 AM
You are welcome, glad that helped.