RobinReumers Posted September 20, 2009 Posted September 20, 2009 I have a value list called "Pricelist". I have a popup showing the value list so that I can select an item. Now I want a script trigger that after someone selects a current category, only the items from this category will be displayed. If I go into the value list editor, I can select "show only related items, …) and this works fine but of course I want to do this in a script step, so that when there is no category selected, it will display all items (if I do this now, it won't display anything based on the relationship).
Matthew F Posted September 21, 2009 Posted September 21, 2009 I'm not sure about the script triggers... You can get a ValueList to automatically switch between two different lists by setting up some special relationships and calculations. Assuming that you have two fields: 'Category' and 'Item', then do the following: Define 2 calculated fields: 1. 'ValueList calc' = If (IsEmpty(Category) ; ValueListItems ( Get(FileName); "All Items" ); ValueListItems ( Get(FileName); "Related Items" ) ) 2. 'RecID' = Get(RecordID) Create 2 extra instances of your table in the relationship graph and create the following self-join relationships: 1. Table::Category = Table2::Category 2. Table::RecID = Table3::RecID Define 3 value lists: 1) 'All Items' = From Field: "Table::Item" 2) 'Related Items' = From Field: "Table2::Item (related values only) 3) Define the 'PriceList' = From Field: "Table3::ValueList calc" (related values only)
Søren Dyhr Posted September 21, 2009 Posted September 21, 2009 I had a stab by implementing it with script triggers, although something still is a bit quirky - is the task done in the vicinity of whats required. --sd straining.zip
RobinReumers Posted September 22, 2009 Author Posted September 22, 2009 Thanks, mfero's one seems to work well. I like calculation fields better to be honest, there are still some people in the office using 8.5. I have one other question. If I have a calculation field that is filled with price IDs (13, 15, 3032, 3504), is it possible to have another relationship with a table that can give names to this, so that I can have a value list with the first column being the ID and the second value the actual name of the corresponding price item?
Matthew F Posted September 23, 2009 Posted September 23, 2009 ... is it possible to have another relationship with a table that can give names to this, so that I can have a value list with the first column being the ID and the second value the actual name of the corresponding price item? I don't think the "Also display values from 2nd field" feature of Value Lists will function correctly with the approach I described. However, you can display a corresponding name or number to your item in a second field if you set up a relationship for this.
Matthew F Posted September 23, 2009 Posted September 23, 2009 Here's an example file... I believe that indexing needs to be turned off in the calculation fields but turned on for the other fields. Combo_ValueLists.fp7.zip
RobinReumers Posted September 27, 2009 Author Posted September 27, 2009 Yes, I finally got it all to work now. Took me some time but thanks to your help it finally works. Thanks a bunch.
Recommended Posts
This topic is 5535 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now