July 8, 200619 yr 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
July 8, 200619 yr 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.
July 10, 200619 yr Author That -2 would be correct and allows me to drop a call to the trim function. Thanks.
July 10, 200619 yr Author 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
Create an account or sign in to comment