Spectrum Technology Platform

Custom Transform Code in Transformer

  • 1.  Custom Transform Code in Transformer

    Posted 02-14-2020 06:56

     I know this sounds very lame, BUT

    I would really appreciate it if someone can provide me with a couple sample code for custom transform to do some basic string manipulations….. such as

    1. Find the length of a string…. If less than two pad with a 0 to the left
    2. If then else
    3. Switch statement
    4. Etc
    5. Etc

     Little sample jobs that does NOT use ConverterDateApi

    I have lots of sample code, but all applicable to Sagent – Spectrum Migrations where the I used the conversion utility to create the code that I then manipulated in the Spectrum environment.  NOW I am on a project where none of the code is working as it is NOT a Sagent – Spectrum migration as such… they are starting a clean Spectrum installation. No Sagent installed anymore …. And no ConverterDateApi available

     

    data['NoOfPacksPerSub']= ConverterDateApi.toInt(ConverterDateApi.ifThenElse(ConverterDateApi.equalEqual(ConverterDateApi.right(ConverterDateApi.toStringFun(data['NoOfPacks']),2),'00'), data['NoOfPacks'], ConverterDateApi.plus(data['NoOfPacks'] , 1)))

     

    Testing for Null

    data['Calculated1']= ConverterDateApi.ifThenElse(ConverterDateApi.equalEqual(ConverterDateApi.IsNull(data['TestNull']),1), 0, data['TestNull'])

     

     

    It is essentially to do string or other manipulations that cannot be done any other way than using the Custom Transform in the Transformer stage…..

     

    Any help will be greatly appreciated.

     

    We are running Spectrum 19.1

     



    ------------------------------
    Sandri Hulbert
    Director - sales, marketing, technical, general
    Alicornio Africa (Pty) Ltd
    Randburg
    ------------------------------