Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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.

Posted

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

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