Jump to content
Server Maintenance This Week. ×

Find in a value list


Vinnyg

This topic is 1075 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

  • Newbies

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...

Link to comment
Share on other sites

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 by comment
Link to comment
Share on other sites

Another option, slightly less convoluted:

Let ( [
values = Substitute ( YourField ; "|" ; ¶ ) ;
filter = Substitute ( YourField ; "|" ; "¶-" ) 
] ;
FilterValues ( values ; filter ) 
)

 

 

Edited by comment
Link to comment
Share on other sites

This topic is 1075 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.