Quartekoen Posted November 25, 2009 Posted November 25, 2009 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
Raybaudi Posted November 26, 2009 Posted November 26, 2009 Try with this modification of your script: PremadeTitles = List ( Table::PremadeTitles )
Recommended Posts
This topic is 5477 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