Data360 Analyze

 View Only
  • 1.  Replace "/" with " " if string contains "/"

    Posted 08-23-2022 09:54
    I'm trying to replace "/" with " " if the string contains a "/", otherwise I want to use the default string value from the input node. I've tried various replace configurations with no luck. I'm new to Data360 but a longtime user of LAE.

    ------------------------------
    Shawn Pelletier
    Knowledge Community Shared Account
    ------------------------------


  • 2.  RE: Replace "/" with " " if string contains "/"

    Employee
    Posted 08-24-2022 11:21
    Given the sample data:



    You can use the following approach:


    Which results in:

    With the Python language you have to explicitly handle Null values before attempting to use string operators.
    You may find useful the information in the 'Migrating from LAE' section of your system's Help documentation, specifically the topic on 'BRAINScript to Python'. The information is also available online here:
    https://d3sa-preview.infogixsaas.com/docs/dist/help/Default.htm#l-migration/script-to-python.htm


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



  • 3.  RE: Replace "/" with " " if string contains "/"

    Posted 08-24-2022 15:04
    Here is my Configure script:
    out1['Employee ID'] = fields['ps.EMPLID']
    out1['Last Name'] = fields['ps.LAST_NAME']
    out1['First Name'] = fields['ps.FIRST_NAME']
    out1['Middle Initial'] = fields['ps.MIDDLE_NAME']
    out1.Email = fields['ps.EMAIL_ADDR']
    out1['Supervisor ID'] = fields['ps.SUPERVISOR_ID']
    out1['Dept Name'] = fields['ps.DEPTNAME']
    out1.Description = fields['ps.LOCATION_NAME']
    out1['Cost Center'] = fields['ps.DEPTID']
    out1['Business Phone'] = fields['ps.XBUSNPHONE']
    out1['Business Mobile'] = fields['ps.XBUSCPHONE']​
    Here is my ProcessRecord script:
    out1 += in1
    
    if in1['Business Phone'] is Null:
        pass
    else:
        out1['Business Phone'] = in1['Business Phone'].replace("/", "-")​

    I'm now getting the following error:
    ERROR: Business Phone does not exist on input (0)"in1". error in ProcessRecords at line 3 (which is where if statement starts.

    ------------------------------
    Shawn Pelletier
    Knowledge Community Shared Account
    ------------------------------



  • 4.  RE: Replace "/" with " " if string contains "/"

    Employee
    Posted 08-25-2022 03:30
    In the ConfigureFields script you are defining the output metadata. This does not affect the definition of fields on the node's input.

    Your ProcessRecords script needs to be changed to the following to reference the input field values:

    out1 += in1

    if fields['ps.XBUSNPHONE'] is Null:
        pass
    else:
        out1['Business Phone'] = fields['ps.XBUSNPHONE'] .replace("/", "-")


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