Use OnObjectSave to perform a script when a value is selected (or OnObjectModify if this is a pop up menu)
The details of the script depend on the values in your value list.
If the values in the value list are the actual layout names, you can use a one line script:
Go to Layout [Table::DropDownListfield]
Use the "Layout Name by calculation" option for the Go to Layout step.
If the values in the list are NOT the layout names, you can use a case function in this calculation:
Case ( Table::dropdownList = "Data Entry" ; "L01--Data Entry" ;
Table::dropdownList = "Reports" ; "L05--Report Setup" ;
and so forth )
I'm creating a drop-down. Is that also called a pop-up? (In which case, I would use OnObjectModify?)
In the inspector, you can format a field as either a drop down list or a pop up menu. A drop down list permits typing data into the field a pop up menu has a slightly different appearance and does not permit typing data into a field.
Thanks for your help with this, Phil. I need some clarification of your "Case" example above. "Date Entry" refers to the actual text of the value list, right? And does "L01--Data Entry" refer to the Layout Name? What role does the "L01" and L05" play in this?
You are reading the expression correctly. The first text in quotes is the actual value in the field. The second quoted text is the actual layout name. I used L01 and L05 as part of the actual layout names just to provide examples where the layout name doesn't exactly match the value list text. Some developers use such conventions to number and name their layouts.
Can I have the values within the value list trigger a script instead of going to a layout? My "go to layout" steps are already in the scripts.
What I am describing would be a script. It just needs only one line to do the change in layouts.
But how would I add other script steps to this, like "New Record/Request" and "Sort" and "Go To Field"?
Go To Layout [ Case ( ....]
and so forth.
The case functionis a calculation inside the go to layout script step. You select the "go to layout name by calculation" option for that Go to Layout step and enter the case function.
You can also, BTW, us a series of If-Else If script steps where each tests for a different value in the value list and has its own go to layout step, but using the case function strikes me as much easier to enter than building all those script steps.
If [Table::dropdownList = "Data Entry" ]
Go to Layout ("L01--Data Entry" (Data Entry ) ]
Else If [Table::dropdownList = "Reports" ]
Go To Layout ["L05--Report Setup"]
OK, this is starting to make sense to me; thanks for your patience.
What if my "Go to Field" and "Sort" steps are different for different values within the Value List?
Also, can the text lines within the Value List in the drop-down have a "roll-over" effect, where they change color as the mouse rolls over them?
Then you'll need the second option with all the If and Else If steps.
Either that, or put those steps in separate scripts performed by the ONLayoutEnter script trigger for each layout.
Most of this is working, Phil. One snag though. A few of the Value List values in the dropdown actually go to the same layout. For those, I need to constrain the result by searching for matching text within a certain field.
For example, the layout that several of these Dropdown values point to is called "Cabinets". ("Cabinets" is within its own Table.) Within the "Cabinets" Table and Layout are 4 different types of cabinets: Wall, Base, Tall, Vanity. So, I need to be able to click on "View Wall Cabinets Only" in the dropdown list, search for "Wall Cabinets" within a certain field, and then sort those results.
I do not want to create separate Tables or Layouts for these items.
I set up the script using the "Case" example you showed me above. Can I further constrain the results within the "Case", or will I need to recreate this using "If and Else If" steps?