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.

Unwanted Value List Sorting

Featured Replies

I have a value list which is populated from a repeating [4] field. Lets say that the values in this field are:

[C, Z, A, F]

And another repeating [4] list like:

[1, 2, 3, 4]

I am currently developing a Filemaker "Email Center" and I would like to include the option for pre-made emails. This way, a salesperson could go in, put in the address of a new customer, and select the "Welcome New Customer" premade email, which would then populate the body of the email with the correct text.

In this way, I would like to have it so that when I select "C" from the dropdown list of premade emails, it fills the body text with "1". When I select "A", it fills the body text with "3". You get the idea.

The way I'm doing this is with a simple 'Set Field' script as a trigger on the Premade Email selection field. The Code I have for this set field step is


Set Field[ Table::EmailBody ; 



Let(

  PremadeTitles = ValueListItems (Get( FileName ) ; "Premade Emails" ) ;



Case( 

   IsEmpty( Table::PremadeSelector ) ; "" 

   Table::PremadeSelector = GetValue( PremadeTitles ; 1 ) ; GetRepetition( PremadeTexts ; 1 )

   Table::PremadeSelector = GetValue( PremadeTitles ; 2 ) ; GetRepetition( PremadeTexts ; 2 )

   Table::PremadeSelector = GetValue( PremadeTitles ; 3 ) ; GetRepetition( PremadeTexts ; 3 )

   Table::PremadeSelector = GetValue( PremadeTitles ; 4 ) ; GetRepetition( PremadeTexts ; 4 )

)

)

]

This works great and all except for one problem. Somewhere (I believe in the ValueListItems function) my Value List is being sorted. This means that when I choose "A", instead of it resulting in "3", it is the first item in the value list, resulting in "1". "Z" becomes "4" instead of "2", and so on.

Obviously, the titles of these premade emails aren't going to be "A", "B", ect... They will have more descriptive names, and these names may change over time. I don't want the list to sort it because if the name changes, suddenly it will appear somewhere else on the list, and it will load the wrong text! Is there some way that I can prevent this sorting?

(also note that we have decided to limit the number of premade emails to a maximum of 4, so it's not really worth it to create a new table, make a lookup, .....)

Thanks in advance

-Quart

Try with this modification of your script:

PremadeTitles = List ( Table::PremadeTitles )

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.