Newbies Vinnyg Posted May 16, 2021 Newbies Posted May 16, 2021 Perhaps I'm having a brain fart, but I'm stumped... I want to isolate "n" number of characters at the beginning of each line in a value list field and put the extracted values into another list field via calculation. The number of values is dynamic based on the user adding items to the list. An example: Value List................ Desired result 0001|Chocolate...... 0001 0002|Christmas...... 0002 , etc. Of course, if I use Left, Middle, etc. I only get the first line of the list. P.S. - I'm forced to go no higher than FileMaker 17, so the While function is off the table.
comment Posted May 16, 2021 Posted May 16, 2021 First I would ask why do you have a value list that combines two values? IOW, why do you put your needles in a haystack, then ask how to find them? Now, to answer your question as asked, i.e.: 1 hour ago, Vinnyg said: I want to isolate "n" number of characters at the beginning of each lin the answer would have to be that this requires recursion, therefore either the While() function or a custom function - provided you have the Advanced version to install a custom function. Or an interim repeating calculation field. Or a looping script instead of a calculation. However, if you look ar the problem from a different point of view, you may be able to do simp[y: Filter ( YourField ; "0123456789¶" ) provided that the list does not contain any digits in the right-hand side parts of the values.
Newbies Vinnyg Posted May 16, 2021 Author Newbies Posted May 16, 2021 I agree that it s a bad idea to have a value list combines 2 values, but I inherited it and am trying to fix it. Your filter idea is good, but I stupidly didn't point out that there could be numbers in the second value, i.e., chocolate2. Filter would return 00012 in that case. I think I'm going to have to go the script route...
comment Posted May 16, 2021 Posted May 16, 2021 (edited) 8 hours ago, Vinnyg said: there could be numbers in the second value Well, you could use: Evaluate ( "\"" & Substitute ( YourField ; [ "|" ; "\¶\" /*" ] ; [ ¶ ; "*/ & \"" ] ) & "*/" ) instead - if you don't mind unreadable code, that is. 8 hours ago, Vinnyg said: I think I'm going to have to go the script route... Do you not have any Advanced version? I have only now noticed that your profile says Version 18. So you could use that to install a custom function, even if users will be using lesser, non-advanced versions. Edited May 16, 2021 by comment
comment Posted May 16, 2021 Posted May 16, 2021 (edited) Another option, slightly less convoluted: Let ( [ values = Substitute ( YourField ; "|" ; ¶ ) ; filter = Substitute ( YourField ; "|" ; "¶-" ) ] ; FilterValues ( values ; filter ) ) Edited May 16, 2021 by comment
Newbies Vinnyg Posted May 16, 2021 Author Newbies Posted May 16, 2021 Beautiful... I thought FilterValues was the way to go, but couldn't figure out the logic. Thanks greatly.
Recommended Posts
This topic is 1353 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