Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Relationship Script Trigger

Featured Replies

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).

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)

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

  • 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?

... 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.

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

  • 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.

Glad to hear it. :

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.