Date: Fri, 29 Mar 2024 00:56:37 +0000 (UTC) Message-ID: <715083235.4082.1711673797063@localhost> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4081_1305092278.1711673797062" ------=_Part_4081_1305092278.1711673797062 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The transformation scripting engine's base concept is based on the Groovy scripting language.
Transformation scripting is an advanced feature for processing data duri= ng import. Thanks to transformation scripts you can:
You are allowed to enter transformation scripts in the column detail dia= log while setting or editting import settings.
Transformation scripts syntax resembles the Groovy and Java syntax. It i=
s designed to be readable and effective but not strict. Users familiar with=
scripting and programming should know, that some of the common features (l=
ike loops) are absent because of security and performance reasons. Script c=
an be applied to and import column. The basic function is transforming<=
/em> the input value of a column row to another value.=
p>
This script trims whitespaces from the beginning and end of the column v=
alue of each data import cell. You can see, that the last line contain=
s command return. The function of the script can be described=
as "pick a value from the current cell, apply function trim and return the=
result". Accessing the value we want to process is a key issue. Scripts provide a=
function value() which returns the current value. There are more advanced =
possibilities to access values: returns the value (String, Number, LocalDate,=
LocalTime - according to column type) of column at returns the value (String, Number, Loca=
lDate, LocalTime - according to column type) of column specified by =
returns the value (String, Number, Loca=
lDate, LocalTime - according to column type) of column specified by =
returns the name of the current column returns the name of the column a returns format of the current column returns default value of the current column, =
which is the value in "Replace empty =
cells with value" You can store values into variables and use them into expressions or as =
a script result. The typing of variables is dynamic thus in most of the cases there is no need to think of a variable =
type. Example of declaring universal variables which are dynamically typed. Yo=
u can assign values to variables for later use: You can retype a variable or function return by adding as nameOfType=
: Type name stores boolean value True / False, used usual=
ly as a result of functions in branching expressions stores a string of characters stores an integer number stores an decimal number represents an Date object in gregorian format=
represents the Date part of the date for usin=
g in date and time functions represents the Time part of the date for usin=
g in date and time functions represents the DateTime object for using in d=
ate and time functions The values function returns a String value. String cannot be handled as =
a number unless it is properly converted. The conversion usually consists o=
f normalization (ex.: round all numbers to 2 decimal place=
s) or cleanup (ex.: replace all "," with ".").Transformati=
on scripts basics
=
Our first script using variable and function:
val =3D=
value()
return trim(val)
How to acces=
s the column values?
Object value()
returns the value (String, N=
umber, LocalDate, LocalTime - according to column type) of current column.<=
/span>
Object value(int columnIndex)=
code>
columnIndex
Object value(String indicatorCo=
de)
indicatorCode. Applicable in existing data sets only.
Object value(String attributeCo=
de)
attributeCode. Applicable in existing data sets only.
LocalDate dateValue()
=
td>
returns the value as LocalDa=
te of current column.
LocalDate dateValue(int colum=
nIndex)
returns the value as LocalDa=
te of column at
columnIndex
LocalDate dateValue(String at=
tributeCode)
returns the LocalDate value =
of column specified by
attributeCode. Applicable in existing d=
ata sets only.
LocalTime timeValue()
=
td>
returns the value as LocalTi=
me of current column.
LocalTime timeValue(int colum=
nIndex)
returns the value as LocalDa=
te of current column at
columnIndex.
LocalTime timeValue(String at=
tributeCode)
returns the LocalTime value =
of column specified by
attributeCode. Applicable in exis=
ting data sets only.
Integer integerValue()
<=
/td>
returns the value as Integer=
of current column.
Integer integerValue(int colu=
mnIndex)
returns the value as Integer=
of current column at
columnIndex.
Integer integerValue(String c=
ode)
returns the Integer value of=
column specified by
attributeCode. Applicable in existing dat=
a sets only.
Double doubleValue()
returns the value as Double =
of current column.
Double doubleValue(int column=
Index)
returns the value as Double =
of current column at
columnIndex.
Double doubleValue(String cod=
e)
returns the Double value of =
column specified by
attributeCode. Applicable in existing data=
sets only.
String name()
String name(int columntIndex)
colimn=
Index
String format()
String defaultValue()
String getFileName()
returns file name of imported file=
String getPath()
returns path to the imported file.=
Useful for zip archives, ftp folders or http connections.
Variables
a =3D v=
alue()
b =3D 12
c =3D 100.56
bool =3D false
e =3D "Hello"
x =3D b + c
return e + " world"
double =
b =3D value() as double
boolean
String
int
double
Date
LocalDate
LocalTime
DateTime
More scripti=
ng language basics
Transformati=
on scripts topics
Advanced script tool=
s