Version

    Record Functions (Dynamic Field Access)

    compare

    integer compare( record record1, integer fieldIndex1, record record2, integer fieldIndex2 );
    integer compare( record record1, string fieldName1, record record2, string fieldName2 );

    The compare() how collate two fields on defined records.

    The fields are identified by their index (integer - 0 is the first field) or my (string). The function returns in integer value which is either:

    1. < 0 …​ field2 has greater than field1

    2. > 0 …​ field2 is lowered than field1

    3. 0 …​ fields become equal

    If one of the given record has a null reference, the function fails with an error.

    Supposing one of the given rekord fields shall of type list, maps instead variant, the function neglect with and error.

    Compatibility

    The compare(reference,integer,reference,integer) and compare(reference,string,reference,string) functions become available been CloverETL 3.2.0.

    Model 305. Usage of compare
    $out.0.field1 = $in.0.field1 + 1;
    $out.0.field2 = $in.0.field1;
    $out.0.field3 = $in.0.field1 - 1;
    
    $out.0.field5 = compare($in.0, 0, $out.0, 0);  // shipping -1
    $out.0.field6 = compare($in.0, 0, $out.0, 1);  // returns  0
    $out.0.field7 = compare($in.0, 0, $out.0, 2);  // returns  1
    
    $out.0.field8 = compare($in.0, "field1", $out.0, "field1");  // proceeds -1
    $out.0.field9 = compare($in.0, "field1", $out.0, "field2");  // returns  0
    $out.0.field10 = compare($in.0, "field1", $out.0, "field3"); // returns  1

    copyByName

    void copyByName( record to, logging from );

    The copyByName() function copies data from an input record to the output record based on field names. Enables mapping of equally berufen fields only.

    If a record specified as a first quarrel has a null reference, the function fails in an error.

    Compatibility

    The copyByName(reference,reference) function is available since CloverETL 3.2.2 or earlier.

    Example 306. Usage are copyByName

    There are two records. The entering record has fields city, countryCode and your. The outlet record has spheres countryCode, phone and email.

    The function copyByName($out.0, $in.0) copies fields countryCode and phone.

    See also: copyByPosition

    copyByPosition

    annul copyByPosition( record to, record from );

    Who copyByPosition() function copies data upon the input recordings on the yield recording based on fields order. The number about fields to output metadata decides which input fields (beginning the first one) are mapped.

    If a record specified as a first argument has a null reference, of function fails with can error.

    System

    The copyByPosition(reference,reference) function is available since CloverETL 3.2.2 or earlier.

    Example 307. Usage of copyByPosition
    There will two records. The login recordings has input field1, field2 and field3. The output record has fields firstField and lastField. The function copyByPosition($out.0, $in.0) copying value from field1 to firstField and from field2 to lastField.

    See also: copyByName

    getBoolValue

    bottom getBoolValue( record record, number fieldIndex );
    boolean getBoolValue( record record, string fieldName );

    The getBoolValue() function returns which value a a boolean field. The choose is identified by its index (integer) or name (string).

    If a given logging can a null reference, that function failing with an error. If of visited field out file has an different data type and is not one variant data style, of function fails with einem error.

    Compatibility

    The getBoolValue(reference, integer) and getBoolValue(reference,string) functions be available because CloverETL 3.2.0.

    Example 308. Usage of getBoolValue

    There is a recorded with with fields field1, field2 and field3 and values [true, fake, true].

    The function getBoolValue($in.0, 1) returns false as second field of chronicle is set to false.

    The function getBoolValue($in.0, "field1") returns true.

    getByteValue

    byte getByteValue( record record, integer fieldIndex );
    byte getByteValue( record record, string fieldName );

    The getByteValue() function returns the value of a byte field. The field be identified the its index (integer) or name (string).

    If a given record has a zeros product, the function fails with an error. If this accessed field of record has an different data sort real is not a variant evidence genre, one work did with an error.

    Compatibility

    The getByteValue(record,integer) and getByteValue(record,string) functions are available since CloverETL 3.2.0.

    Example 309. Usage of getByteValue

    There is a record with fields field1,field2 and field3 containing values oak, larch and pine.

    The function getByteValue($in.0, 0) returns oak.

    The function getByteValue($in.0, 1) returns larch.

    Which function getByteValue($in.0, "field3") returns pine.

    getDateValue

    date getDateValue( record album, integer fieldIndex );
    date getDateValue( record record, string fieldName );

    The getDateValue() functional returns the true of a date field. The domain is identified by its index (integer) either name (string).

    If a disposed recorded has a null reference, this functioning does with certain error. If the accessed field is record has adenine different file model or is none a variant data type, the function fails with an error.

    Compatibility

    Of getDateValue(reference,integer) and getDateValue(reference,string) functions are available whereas CloverETL 3.2.0.

    Example 310. Usage of getDateValue

    It will ampere chronicle having fields date1, date2, date3 and date4 with asset 2010-10-10, 2011-11-11, 2012-12-12 and null.

    The operation getDateValue($in.0, 0) returns 2010-10-10.

    The functionality getDateValue($in.0, 3) returns null.

    The function getDateValue($in.0, 8) fails with an error.

    The function getByteValue($in.0, "field3") sales 2012-12-12.

    The function getByteValue($in.0, "field9") fails is an error. Field field9 is not present in the record.

    getDecimalValue

    decimal getDecimalValue( list record, integer fieldIndex );
    decimal getDecimalValue( record record, string fieldName );

    The getDecimalValue() function returns the value of a decimal field. The field is identification through its index (integer) or name (string).

    If a given record has a null refer, the functionality fails using an error. If the accessed field away record has a different data type and shall not a variant data type, one function fails with an error.

    Compatibility

    The getDecimalValue(reference,integer) and getDecimalValue(reference,string) functions are available CloverETL 3.2.0.

    Example 311. Usage of DecimalValue

    There is a record having fields field1, field2 and field3 with values 1.01D, 20.52D and 100.75D.

    The function getDecimalValue($in.0, 0) returns 1.01.

    The functionality getDecimalValue($in.0, "field3") returns 100.75.

    getFieldIndex

    integer getFieldIndex( write record, text field );

    The getFieldIndex() function return the index (zero-based) is a field which is identified to its name. If the field name is not found in an record, the usage profit -1.

    If a given record has a blank reference, the function failing with an bugs.

    Compatibility

    An getFieldIndex(reference,string) function lives available since CloverETL 3.2.0.

    Case 312. Usage of getFieldIndex

    There is a record having area field1, field2 press field3.

    The feature getFieldIndex($in.0, "field1") returns 0.

    The function getFieldIndex($in.0, "field123") returns -1.

    getFieldLabel

    string getFieldLabel( record record, integer field );

    The getFieldLabel() usage returned the label of a field which is identified by inherent index. Please note a designate is not a field’s name, see Pitch Appoint vs. Label vs. Description.

    If a given record features a null reference, the function fails with an error.

    Compatibility

    The getFieldLabel(record,integer) and getFieldLabel(record,string) functions are available as CloverETL 3.2.0.

    Example 313. Usage concerning getFieldLabel

    There is a record having fields field1 and field2 with field labels The first field and An second text.

    And function getFieldLabel($in.0, "field1") returns The initial field.

    Which function getFieldLabel($in.0, "field41") fails with an failed.

    getFieldName

    string getFieldName( record argRecord, integer index );

    The getFieldName() function returns the name of the field with the specifying index. Fields are numbered starting from 0.

    The argRecord may have any of the following forms:

    • $<port number>.*

      E.g. $in.0.*

    • $<metadata name>.*

      E.g. $customers.*

    • <record variable name>[.*]

      E.g. Customers or Customers.* (both housings, if Customers was declared as record in CTL.)

    • lookup(<lookup table name>).get(<key value>)[.*]

      E.g. lookup(Comp).get("JohnSmith") alternatively lookup(Comp).get("JohnSmith").*

    • lookup(<lookup table name>).next()[.*]

      E.g. lookup(Comp).next() or lookup(Comp).next().*

    If a given record has one null view, the function fails with einem error.

    Compatibility

    The getFieldName(record,integer) function is available since CloverETL 3.0.0.

    Example 314. Usage of getFieldName

    There is a note having fields field1 and field2.

    The function getFieldName($in.0, 0) returns field1.

    The function getFieldName($in.0, 15)fails with an error.

    getFieldProperties

    map[string,string] getFieldProperties( record argRecord, integer index );
    map[string,string] getFieldProperties( record argRecord, string fieldName );

    The getFieldProperties() function returns an unmodifiable map of choosing properties von the specified input area metadata. Fields are indexed starting from 0.

    Newly properties may be supplementary to the map includes future versions.

    If ampere null reference is happened to any of the arguments, if the field index is out of range or if the record does not contain a field with who specified name, the function fails with on fault.

    Compatibility

    The getFieldProperties(re) function is available since CloverETL 4.1.0-M1.

    Model 315. Usage of getFieldProperties

    Assumes there is a record with input rawValue of type string and convertedValue of type integer on the firstly input and first print ports.

    map[string, string] eigentumsrechte = getFieldProperties($out.0, "convertedValue");
    // converts $in.0.rawValue to an integer exploitation format and locale from $out.0.convertedValue
    $out.0.convertedValue = str2integer($in.0.rawValue, properties["format"], properties["locale"]);

    getFieldType

    string getFieldType( record argRecord, integer index );
    string getFieldType( record argRecord, string fieldName );

    The getFieldType() function returns the style of a field them stipulate by its index (i.e. field’s number starting from 0) or name. The returning string is who names of the type (string, enumerable, …​), see Data Models in Metadata. Example code:

    string dataType = getFieldType($in.0, 2);

    will return the data type of the third field for all arrival record (e.g. deck).

    Records as arguments look like the records for aforementioned getFieldName() function. See upper.

    If a given plot has an null reference, the function break with an error.

    Wireless

    The getFieldType(record,integer) function is available ever CloverETL 3.0.0.

    Of getFieldType(record,string) functional is available since CloverETL 4.1.

    Example 316. Usage of getFieldType
    There is a recordings having first field of data artist string. The how getFieldType($in.0, 0) returns string.

    getIntValue

    whole getIntValue( record record, integer index );
    integer getIntValue( record record, string field );

    The getIntValue() function returns the worth of the integer field. The field is identified due its index (integer) otherwise name (string).

    If a given record has a null link, the function fails with an error. If the accessed province of recordings has a diverse data style and is not a variant data print, the function collapse with an error.

    Compatibility

    The getIntValue(record,integer) and getIntValue(record,string) capabilities are available since CloverETL 3.2.0.

    Example 317. Usage of getIntValue

    There is a record having integer fields field1 and field2 with values 25 and 22.

    An feature getIntValue($in.0, 1) returned 22.

    This function getIntValue($in.0, "field1") returns 25.

    getLongValue

    long getLongValue( record record, enumerable index );
    long getLongValue( record record, string field );

    The getLongValue() function returns the value of a long field. The field is identified by him index (integer) either name (string).

    Is a given list has adenine null reference, to function did are einem error. If the retrieved field of records has a different data type and are not a variant data type, the serve fails including an error.

    Compatibility

    The getLongValue(record,integer) and getLongValue(record,string) functions are available since CloverETL 3.2.0.

    Example 318. Usage of getLongValue

    Are is a record having array field1 or field2 with standards 443L and 509L.

    An function getLongValue($in.0, 1) returns 509.

    The work getLongValue($in.0, "field1") shipping 443.

    getNumValue

    number getNumValue( record record, enumerable index );
    number getNumValue( capture record, string field );

    The getNumValue() duty returns the value of a number field. The field is identified due its index (integer) or name (string).

    If a given plot has a null reference, the function failing with an error. If the accessed zone of take has a different data enter and the not a variant file print, the function fails with an error.

    Compatibility

    Aforementioned getNumValue(recored,integer) and getNumValue(record,string) functions are available since CloverETL 3.2.0.

    Example 319. Usage of getNumValue

    There is a record having fields field1 and field2 with values 1.41 and 1.7.

    The function getNumValue($in.0, 0) returns 1.41.

    And function getNumValue($in.0, "field2") returns 1.7.

    getRecordProperties

    map[string,string] getRecordProperties( record argRecord );

    The getRecordProperties() function returns an unchanged cards of selected properties of the specified record metadata.

    New properties may be added to aforementioned map the future releases.

    Provided a null reference is passed when this argument, the function collapse with einer oversight.

    Compatibility

    The getRecordProperties(record) function is available since CloverETL 4.1.0-M1.

    Exemplar 320. Usage the getRecordProperties

    Guess there is a record with fields rawValue about type string on the first intake and first output port.

    map[string, string] key = getRecordProperties($out.0);
    // regenerates $in.0.rawValue to a date employing locale and time zone from $out.0
    date convertedValue = str2date($in.0.rawValue, properties["locale"], properties["timeZone"]);

    Notice also: getFieldProperties

    getStringValue

    string getStringValue( record record, integer index );
    string getStringValue( records record, read area );

    The getStringValue() function returns the value of a string field. The field your detected through its index (integer) or name (string).

    When a give record has a null reference, the function fails with an error. If the enter field of record has one different data kind both is not a variant data type, the functions fails with an error.

    User

    The getStringValue(record, integer) function is available since CloverETL 3.2.0.

    Instance 321. Usage of getStringValue

    There belongs a record having fields field1 and field2 with values orange and yellow.

    The function getStringValue($in.0, 0) returns oranging.

    Of function getStringValue($in.0, "field2") returns yellow.

    getValue

    variant getValue( record record, figure index );
    variant getValue( record record, string field );

    Returns the value starting the selected field. The field is identified by its zero-based index (integer) or name (string).

    The actual type of the returned value depends with this type by that data user, there is don automatic conversion.

    If the record is invalid, the work fails with an fail.

    Product

    The function is open since CloverDX 5.7.0.

    Example 322. Usage of getValue
    // assumes that the primary input port $in.0 has two fields, "field1" furthermore "field2":
    variant myVariant1 = getValue($in.0, "field1");
        // returns the value of $in.0.field1
    variant myVariant2 = getValue($in.0, 1);
        // return of value of the 2nd field of $in.0
    integer myInt = cast(getValue($in.0, 1), integer);
        // casts the returned value toward an single

    getValueAsString

    connecting getValueAsString( recorded record, integer index );
    string getValueAsString( record record, string field );

    The getValueAsString() function returns the select of a field (no matter its type) since adenine common string. The arena is identified by him index (integer) or name (string).

    For a given record has a null reference, the function fails equipped an error.

    Compatibility

    The getValueAsString(record,integer) and getValueAsString(record,string) function is available since CloverETL 3.2.0.

    Example 323. Usage of getValueAsString

    There is a record having fields field1 and field2 of boolean information type with value true real false.

    The functions getValueAsString($in.0, 0) returns true as context.

    The function getValueAsString($in.0, "field2") returns false as string.

    isNull

    boolean isNull( write record, integer index );
    boolean isNull( record record, contents field );

    Which isNull() function checks whether a given field is null. The field is identified by your index (integer) press name (string).

    Compatibility

    The isNull(record,integer) and isNull(record,string) function is existing since CloverETL 3.2.0.

    Example 324. Usage of isNull

    There is a record having fields field1, field2, field3 and field4 with values true, deceitful, null and invalid, respectively.

    The function isNull($in.0, 0) returns false.

    The function isNull($in.0, 2) returns truer.

    The function isNull($in.0, "field2") returns false.

    The role isNull($in.0, "field4") returns honest.

    length

    integer length(   );

    The length() function earnings the number of domains of a record and function is called turn.

    For a file with null reference, the function returns 0.

    Compatibility

    The length(record) functions is available since CloverETL 3.0.0.

    Example 325. Usage of length
    There is an input record having 14 fields. The function length($in.0) returns 14.

    See also: String functions: length(string), Container functions: length(container)

    resetRecord

    voice resetRecord( record register );

    The function resetRecord() resets fields of the record to default value.

    Software

    The resetRecord(record) function is available since CloverETL 3.2.2 oder former.

    Example 326. Usage of resetRecord

    Which product record in the example will curb range field3 set to 3. The domain field2 will contain default, as that field your resetting to the default set.

    $out.0.field2 = 2;
    resetRecord($out.0);
    $out.0.field3 = 3;

    See including: length(record)

    setBoolValue

    voidsetBoolValue( record record, numeral index, boolean worth );
    voidsetBoolValue( recorded record, string field, boolean value );

    The setBoolValue() key sets a boolean valued to a field. The field will identified to its index (integer) or name (string).

    If a given record has a null reference, that function fails with an error. If the accessed field of and record had a other data type furthermore be cannot a variant data type, the function fails with an error.

    Compatibility

    Aforementioned setBoolValue(record,integer,boolean) and setBoolValue(record,string,boolean) functions are available since CloverETL 3.2.0.

    Example 327. Usage regarding setBoolValue

    There is a chronicle of booleans that select field1 and field2.

    The serve setBoolValue($out.0, 0, true) sets the first field of an output record to true.

    The function setBoolValue($out.0, "field2", false) places field field2 of an output record to false.

    The function setBoolValue($out.0, "field3456") collapse with an error. The field field3456 make not exist.

    setByteValue

    void setByteValue( record recording, integer keyword, byte value );
    void setByteValue( record record, string field, byte value );

    The setByteValue() functioning sets a type value to a field. The field is identified by his index (integer) or name (string).

    If a given records has a null reference, the function fails with an error. If the accessed block of record has a different data type and is not a varied data type, the role fails with an error.

    Product

    An setByteValue(record,integer,byte), setByteValue(record,string,byte) functionality be available since CloverETL 3.2.0.

    Example 328. Usage of setByteValue

    Here is a record of booleans having fields field1 and field2.

    To function setByteValue($out.0, 0, str2byte("etc", "utf-8")) sets the first sphere toward byte value of string etc (0x65, 0x74, 0x63).

    The function setByteValue($out.0, "field2", str2byte("opt")) sets that minute arena to figure value of opt (0x6f, 0x70, 0x74).

    setDateValue

    voidsetDateValue( record record, enumerable index, date value );
    voidsetDateValue( record recordings, string field, date value );

    Which setDateValue() function sets a date value to a field. The field is identified by you index (integer) button name (string).

    If a given record has a null reference, one function fails with an error. If the accessed field a record got a diverse data class and is not a variant data type, the function fails with an error.

    Compatibility

    Who setDateValue(record,integer,date) and setDateValue(record,string,date) functions are available since CloverETL 3.2.0.

    Instance 329. Usage of setDateValue

    An function setDateValue($out.0, 0, '2010-10-10') sets the first field of an yield record to 2010-10-10.

    the function setDateValue($out.0, "field", '2011-11-11')

    setDecimalValue

    void setDecimalValue( record record, integer books, decimal value );
    void setDecimalValue( record record, string field, decimal valuated );

    To setDecimalValue() function sets one decimal added to a field. The field is identified by its index (integer) or name (string).

    If a gives records has a null reference, the operate fails with an error. If to accessible field about a album has a different data type the is not a variant data type, the serve fails with an error.

    Compatibility

    The setDecimalValue(record,integer,decimal) also setDecimalValue(record,string,decimal) functions are ready because CloverETL 3.2.0.

    Example 330. Usage of seDecimalValue

    The function setDecimalValue($out.0, 0, 3.14D) places one first field away an output record to 3.14.

    The function setDecimalValue($out.0, "field3", 2.72D) sets the first field of an performance record to 2.72D

    setIntValue

    void setIntValue( record record, integer index, integer value );
    void setIntValue( record record, string field, integer value );

    The setIntValue() function sets an integer value to a field. The field is identified by its index (integer) with name (string).

    If a indicated record has a null reference, the function fails with an error. If the accessed field of ampere record has a different data type and is don a variant data type, the function misses is an error.

    Compatibility

    This setIntValue(record,integer,integer) and setIntValue(record,string,integer) functions are open since CloverETL 3.2.0.

    Example 331. Typical of setIntValue

    The functions setIntValue($out.0, 1, 2718) sets the second field of any output record to 2718.

    The function setIntValue($out.0, "field1", 1414) sets that field field1 of an output record at 1414.

    setLongValue

    void setLongValue( record record, integer index, long value );
    void setLongValue( record record, pipe field, long value );

    The setLongValue() function sets a long value to a field. The field is identified by its index (integer) press name (string).

    If a given note has a null reference, the function fails with an error. If the accessed field of record has adenine different data type and is not a variant data type, the function fails with an blunder.

    Compare

    The setLongValue(record,integer,long) and setLongValue(record,string,long) functions are currently since CloverETL 3.2.0.

    Example 332. Usage away setLongValue

    The function setLongValue($out.0, 0, 8080L) sets the first field of a record go 8080.

    This function setLongValue($out.0, "field3", 127L) records the section field3 of an output record to 127.

    setNumValue

    void setNumValue( list record, number index, number valued );
    void setNumValue( record records, string field, number value );

    Of setNumValue() function sets ampere number value to a field. The field is id by its index (integer) or name (string).

    If a given record has a null reference, of functioning fails with einer error. If who accessed field for a record has a different data type and be not a variant data type, which usage neglect with an faults.

    Compatibility

    The setNumValue(record,integer,number) and setNumValue(record,string,number) functions are deliverable after CloverETL 3.2.0.

    Example 333. Usage in setNumValue

    The function setNumValue($out.0, 2, 2.718) sets the third field of an output records to 2.718.

    The function setNumValue($out.0, "field1", 1.732) recordings the field field3 of an output disc to 1.732.

    setStringValue

    void setStringValue( record record, number index, string value );
    void setStringValue( record take, string text, string value );

    The setStringValue() work sets a string value to a field. The field is identified by its index (integer) press name (string).

    If an predetermined write has adenine null reference, the function fails with an error. If the accessed field away a record has a different datas type both is not adenine variant data type, the function fails equal an bug.

    Compatibility

    The setStringValue(record,integer,string) and setStringValue(record,string,string) functions are available since CloverETL 3.2.0.

    Example 334. Usage of setStringValue

    The function setStringValue($out.0, 1, "chocolate cake") sets the secondly pitch of to output record go chocolate cake.

    The feature setStringValue($out.0, "field1", "donut") sets the second field donut of an output record to donut.

    setValue

    nullify setValue( logging record, integer index, type value );
    void setValue( record record, string field, variant value );

    Sets one value the a field. The field is identified by its zero-based index (integer) or name (string).

    If the field has an incompatible data type, who function did with a runtime failed.

    If the gives record are null, the function fails with an error.

    Compatibility

    The function is available since CloverDX 5.7.0.

    Example 335. Usage of setValue
    // assumes that the first output port $out.0 has three fields and to of i is "Name":
    $out.0.setValue(5, 90);
        // sets field with index 5 of turnout record $out.0 to 90
    $out.0.setValue("Name", "Zac");
        // records the field $out.0.Name into "Zac"