December 12, 200817 yr 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
December 12, 200817 yr If [ Length ( YourField ) > 2 ] Set Field [ YourField; Replace( YourField; Length ( YourField ) - 3; 3; Target ) ] End If Edited December 13, 200817 yr by Guest Fixed misplaced closing parenthesis
December 12, 200817 yr Author 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 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
December 12, 200817 yr Author 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
December 13, 200817 yr It should be: Replace ( ControlName ; Length ( ControlName ) - 2 ; 3 ; DEP_Itin_1 ) or, if you like: Left ( ControlName ; Length ( ControlName ) - 3 ) & DEP_Itin_1
Create an account or sign in to comment