Data360 Analyze

Welcome to the Data360 Analyze community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Here are some useful links where you can find more information:

Product Announcements  Product Documentation  Ideas Portal

Discussions

Members

Resources

Events

 View Only
  • 1.  field.replace("this","that") as newfield

    Employee
    Posted 09-05-2016 03:43

    Hi, betatesting 7 and was wondering if I can't use one transform to do this:

    emit *
    emit Office.replace("Proffice-", "") as AOffice
    emit AOffice.replace("PIL-", "") as BOffice
    emit BOffice.replace("Care Läkar-","") as COffice
    emit COffice.replace("Care Läkar -","") as DOffice
    emit DOffice.replace("PS-","") as EOffice

    Or do I need one transform for every replace?

    Regards

    thomas



  • 2.  RE: field.replace("this","that") as newfield

    Employee
    Posted 09-05-2016 04:16

    Hi Thomas,

     

    If the intention is to output a single field where all the prefixes have been stripped from the values in the 'Office' field then you can just chain the replace() statements, e.g.

    FOffice = Office.replace("Proffice-", "").replace("PIL-", "").replace("Care Läkar-","").replace("Care Läkar -","").replace("PS-","")

    emit *, FOffice

    If you really want to output separate fields for each new field (AOffice - EOffice) then you could use this script:

    AOffice = Office.replace("Proffice-", "")
    BOffice = AOffice.replace("PIL-", "")
    COffice = BOffice.replace("Care Läkar-","")
    DOffice = COffice.replace("Care Läkar -","")
    EOffice = DOffice.replace("PS-","")


    emit *, AOffice, BOffice, COffice, DOffice, EOffice

     

    Regards,

    Adrian



  • 3.  RE: field.replace("this","that") as newfield

    Employee
    Posted 09-06-2016 02:10

    Thanks!