Kris M Posted July 8, 2006 Posted July 8, 2006 I have table 1 field 1 formated as text and the source of the value is imported via script from a .csv file and "n" quantity of records where "n" > 0. The only two possible formats for values in field 1 are... xxx, xxx xxx, vvv or xxx, xxx xxx (xxx), vvv where x equals any alphabetic text value, vvv equals any positive integer, and the spaces are exactly as written. I have to reduce field 1 values from their current format to: A. In the first case, remove everything after and including the second "," B. In the second case remove everything after and including the first "(". I know i can.... go to correct layout go to first record start loop set variable($1;Value:Position(field 1; ",", 2)) set variable($2;Value:Position(field 1; "(", 1)) but then how do I use these variables to replace the values in field 1 with the edited values for "n" quantity of records? (i.e. if field 1 record 1 contains "jerry, thomas b, 1234" how do I truncate field 1 record 1 to "jerry, thomas b") TIA, Kris M
comment Posted July 8, 2006 Posted July 8, 2006 I don't think you need the variables. Simply set the field to: Let ( pos = Position ( field ; "(" ; 1 ; 1 ) ; Case ( pos ; Left ( field ; pos - 1 ) ; Left ( field ; Position ( field ; "," ; 1 ; 2 ) - 1 ) ) ) Note that I have taken the remove everything after and including the first "(" requirement literally, but it seems like it leaves an extra space - so perhaps Left ( field ; pos - 2 ) ; might be more appropriate.
Kris M Posted July 10, 2006 Author Posted July 10, 2006 That -2 would be correct and allows me to drop a call to the trim function. Thanks.
Kris M Posted July 10, 2006 Author Posted July 10, 2006 Ok now i have a detail question regarding the case function... You have the test written as pos with no evaluation...Pos can have two values either zero, if the "(" is not found, or an integer for the position of the first "(" starting from the first position. How does this evaluate to true or false as is stated in the functions ref? I am wondering how case knows which result to return. TIA Kris
comment Posted July 10, 2006 Posted July 10, 2006 In Filemaker, any numerical value other than 0 evaluates to TRUE.
Recommended Posts
This topic is 6710 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