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

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

Recommended Posts

Posted

Hi Everyone....Happy holidays...

I can use some help if someone is available.

I need a script that will trim the last 3 letters from a string of text in a specified field and replace them with 3 letters from a target field.

It will always be 3 letters and it will always be the last three letters that need need to be swapped.

Any help would be greatly appreciated.

Thanks,

Steve

Posted (edited)

If [ Length ( YourField ) > 2 ]

Set Field [ YourField; Replace( YourField; Length ( YourField ) - 3; 3; Target ) ]

End If

Edited by Guest
Fixed misplaced closing parenthesis
Posted

Hey Mister V....

I tried your suggestion and it is sticking the 3 letters I need immediatly after the first letter in the required field.

Here is the field (ControlName) as entered before running the script:

EUROPE-ITALY-Washington-HS-AZ-rdu

The last three letters [rdu] need to be replaced with the letters "nyc" as in the field (Departure).

Below is the result if I run the script as currently entered :B

EnycPE-ITALY-Washington-HS-AZ-rdu

If[(Length(ControlName)>2)]

Set Field [ControlName;

Replace( ControlName; Length ( ControlName-3 ); 3; DEP_Itin_1)

Have I made a mistake here? The result should look like this:

EUROPE-ITALY-Washington-HS-AZ-nyc

Thanks for your help...It is very much appreciated.

Steve

Posted

Sorry try it now. I misplaced the closing paranthesis when typing.

Posted

Hey V...

Sorry but this won;t work either...FM won;t let me closwe the dialog because of the add ( at the end.

Your Code

Replace( YourField; Length ( YourField ) - 3; 3; Target ) )

My Code

Replace( ControlName; Length ( ControlName- 3 ); 3; DEP_Itin_1))

I really appreciate your help.

Steve

Posted

It should be:

Replace ( ControlName ; Length ( ControlName ) - 2 ; 3 ; DEP_Itin_1 )

or, if you like:

Left ( ControlName ; Length ( ControlName ) - 3 ) & DEP_Itin_1

This topic is 5825 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.