MyRapidi
MyRapidi

Search our Wiki

COPY

Copy(data, from, length);

Using the Copy function, you can copy a section of a text by specifying the minimum and maximum of that value. This formula is useful when you have a field length limitation in the destination system.

 

Example 1:

The formula ##COPY("Name", 0, 6) will transfer the first 6 characters from the source field "Name".The value of the field "Name" is: Rapidi A/S. And the result value will be Rapidi ( since length is set up to a maximum of 6 characters.

Another example is the formula ##COPY("Name", 7, 9) which will transfer characters from position 7 to 9. In this scenario, the result value will be A/S since the length is between the last 7 and 9 characters.

 

Example 2:

In this example the FieldType in the Source and Destination fields does not match:

Source Fieldtype = VarChar: Value = KKK1243000

Destination FieldType = Integer:

 

##COPY(FieldName, 3, 7);

Returns the value = 1243000

which is compatible with the integer datatype.

 

In some cases you need to add a TOINTEGER formula to ensure that values are compared correctly during transfer, or if you need to calculate on the field:

 

##TOINTEGER(COPY(FieldName, 3, 7))

Example 3:

 

The formula ##COPY("BillingCity",0,29) will transfer the first 29 characters from the source field "BillingCity".