Data360 Analyze

 View Only
Expand all | Collapse all

Combine an existing cell with Static text and input into new column

  • 1.  Combine an existing cell with Static text and input into new column

    Posted 05-27-2022 05:41
    Hi,

    In my dataset I have an account number (set as 'LONG'). I have also created two new columns using a Transform node (OldLedgerNbr and NewLedgerNbr).

    test data
    I need to do two things:

    1. In the column titled OldLedgerNbr i need to combine the string 'IN' with the account number in the Account Number column (example result = IN123456)

    2. In the column titled NewLedgerNbr i need to combine the string 'IN' with a fixed number for all rows (example result in all rows = IN987654)

    What is the best way to do this?


    ------------------------------
    Nathan Schofield
    Telstra Corporation Limited
    Sydney NSW
    ------------------------------


  • 2.  RE: Combine an existing cell with Static text and input into new column

    Employee
    Posted 05-31-2022 11:02
    Hi Nathan,

    You can use the following approach:


    The value for the FixedLedgerNbr variable is defined in the ConfigureFields script rather than the ProcesRecords script since it only needs to be specified once.
    The code in the ProcessRecords script is defensive and tests for a Null value in the 'Account Number' field.

    Note: In this case it is likely to be ok to use a string (str) data type for the NewLedgerNbr and OldLedgerNbr fields. However, it is advisable to use the unicode data type for strings in situations where you cannot guarantee that only ASCII character values will be included in the string.

    Regards,
    Adrian

    ------------------------------
    Adrian Williams
    Precisely Software Inc.
    Naperville IL
    ------------------------------