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.

Featured Replies

I have a list of items in a category dropdown list.  If a user clicks on the dropdown and the item they want is not there, they can type the new item in.  I want to add the new item to the list for future users.

I have never used a loop before and the below script ends up in an infinite loop.  I run it as a scrip trigger on the Category field as an OnObjectExit.  I was hoping that once the item was entered into the field the script would loop through the existing list and exit if it found the item already exists.  If it did not find the word it would add it to the list.  Can someone help me with this please??

image.png.23eb900528f563ad0e513aec73eceb47.png

First, there is no need for a loop here. You can simply check if the entered value is present in the value list used by the drop-down:

Set Variable [ $category ; Data::dataCategory ]
If [ IsEmpty ( FilterValues ( $category ; ValueListItems ( "" ; "YourValueListName" ) ) ) ]
  Go to Layout [ "Values" ]
  New Record
  Set Field [ Values::category ; $category ]
  Go to Layout [ original layout ]
End If

If you wanted to do this by checking every record in the Values table, you would have to make sure to raise a flag when a match is found. Otherwise you would not be able to tell whether the loop was exited because a match was found, or the loop had simply reached the last record:

Set Variable [ $category ; Data::dataCategory ]
Go to Layout [ "Values" ]
Show All Records
Go to Record [ First ]
Loop
  Set Variable [ $match ; $category = Values::category ]
  Exit Loop If [ $match ]
  Go to Record [ Next; Exit after last ]
End Loop
If [ not $match ]
  New Record
  Set Field [ Values::category ; $category ]
End If
Go to Layout [ original layout ]

--
Caveat: untested (both).

 

Edited by comment

  • Author

That works fine.  Thanks for your help here.  Always learning.

Greg

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.