September 17, 20196 yr Hello, I have a number field where I want the user to be able to enter things like: 42 (only item 42) 12+82 (only items 12 and 82) 1-5 (items 1 through 5) 31,33,35,37 (only items 31,33,35,37) So I am need of a way for filemaker to deal with the operators '+' '-' and ',' Do you have any advice on how I can separate out the item numbers? Thanks!
September 17, 20196 yr Actually, you only need to "deal" with the "-" operator. The "+" and the comma can be simply substituted with a carriage return to get a list that Filemaker recognizes as a list of values (assuming that's what you want as the result). Iterating from 1 to 5 and creating the intermediate values requires either a custom recursive function or the While() function or a looping script. Please update your profile to reflect your version and OS so that we know which one of these you can use. -- Note: 1. A field where a user is allowed to enter "12+82" or "1-5" or "31,33,35,37" should be a Text field. 2. You may face a difficulty if a user enters a value that does not fit one of your 4 formats listed above. Edited September 17, 20196 yr by comment
September 17, 20196 yr Author Thanks so much for your help, I have updated my profile and started work on the + and ,
September 17, 20196 yr If you don't have the Advanced version, you cannot use a custom function (unless someone installs it for you). And if you don't have version 18, you cannot use the While() function. That leaves us with a looping script. The attached demo shows how it could work. Note that you can use a script trigger to run the script automatically OnObjectSave. ProcessEntry.fmp12
September 17, 20196 yr Author Thank you so much comment, your file is perfectly clear. The next hurdle I am working on is to allow the user to have both in the same list. For example: 1-5,19+25,30-33 I believe I should turn the + and , into carriage returns first, then deal with the hyphens with a loop through the list entries somehow Edited September 17, 20196 yr by nsdodgers
September 18, 20196 yr 6 hours ago, nsdodgers said: I believe I should turn the + and , into carriage returns first, then deal with the hyphens with a loop through the list entries somehow I would start by substituting "+" and "," with ¶. Then loop over the resulting values. If the current value contains "-", create the intermediate values and add them to the result. Otherwise add the value to the result. Edited September 18, 20196 yr by comment
September 27, 20196 yr Author It's the reverse of what we worked on in the other post. Going from a list to a range Edited September 27, 20196 yr by nsdodgers
Create an account or sign in to comment