I have a drop down list on a layout with a list of report names listed. Now how do you get the drop down list to open up a new window and display the layout with the selected drop down list the user selects? Appreciate the help.
First, you'll have to create a script (if you already haven't) that will execute the desired action for the report selected. In that script you'll have to test against a selected value in the drop down field using an If statement. For example, If drop down field = "weekly report" then execute a portion of script. You only need one If statement, use Else If statements for additional criteria to test against ( If, else if, else if, else if, end if). Secondly, set up your drop down field to have a Script Trigger (on exit) that will execute the script. That way whenever a user makes a selection from your list, what they're actually doing is setting the drop down field to one of the values from your selection. And when the record is committed the script is run that will execute the portion of code pertaining to the selection made. I will attach a
screenshot of example code I've used. Notice that I'm clearing my drop down field right away though.
Thank you so much for the reply I get what your trying to do. The part I'm confused now is when I am creating the script I try and "specify" the "if " statement and it only allows me to chose the values from a table. How would the "if" statement look like if I am getting the values populated in the drop down list from a static value list and not from a db table? Hope that makes sense?
The piece of code you posted that reads " if [_ApprovedMaterial_AM::Navigation1 = "MAIN"] " is what i don't understand how to write I guess if I am getting the values from a static value list and not from a db table.
Appreciate the help.
Just make the contents of your If() condition the required text from the drop down list. EG:
If [ yourTableName::textField = "item one from my list" ]
Go to Layout [ yourLayoutNameForItemOne ]
Else If [ yourTableName::textField = "item two from my list" ]
Go to Layout [ yourLayoutNameForItemTwo ]
Etc Etc Etc
It really doesn't matter how the list is generated. What matters is that the contents of the field match what is specified in your script.
Keywords and John thank you all with both posts I was able to get this to work! Awesome! Appreciate the feedback!
Thought it was a little weird that how the list was generated didn't matter I just put in a table name and textfield as you said, but oh well it works. =)
If the names in your value list (exactly) match your actual layout names, your script could use the Go to Layout - Layout Name by calculation script step, and the script would simply be something like:
Go to Layout [your_table::your_field]
The script could be triggered by on OnObjectModify script trigger or a button
oh nice chris thanks for that information!
How would the "if" statement look like if I am getting the values populated in the drop down list from a static value list and not from a db table?
In general, when interacting with a Value List you have to assign it to a field. In the example code I posted "Navigation1" is a specific field on the "_ApprovedMaterial__AM" table that I use to display a Value List of custom values. I do two things to that field. First, in Layout Mode using the Inspector, assign your value list to the dedicated field (use a Drop Down list). Secondly, in Manage Database, under field options assign the text field to only allow values from your Value List. With that done, every time a user enters the field they will only see your Value List. And, they will only be able to enter a value from that list.
With that said, your If statment is testing for literal values that will be set in your value list field. Say for instance one of your value list values is "MAIN" like in my previous posting, your If statemtent then is testing whether or not the field (which only gets its values from your Value List) equals a specific value. In the event that it does, you execute whatever code your trying to accomplish. In the event that it does not, use an Else If to test the value list field against an alternate value from your value list.
AAaaah that makes sense now! Kind like having a skin on top of a table. ahaha interesting but thank you for that clarification john_j!
Retrieving data ...