September 20, 200916 yr 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).
September 21, 200916 yr 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)
September 21, 200916 yr 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
September 22, 200916 yr Author 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?
September 23, 200916 yr ... 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.
September 23, 200916 yr 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
September 27, 200916 yr Author Yes, I finally got it all to work now. Took me some time but thanks to your help it finally works. Thanks a bunch.
Create an account or sign in to comment