US and Worldwide: +1 (866) 660-7555
Results 1 to 2 of 2

Thread: If field value is null does not work on ubuntu

  1. #1
    Join Date
    Aug 2007
    Posts
    24

    Default If field value is null does not work on ubuntu

    Hi,

    I need to replace all NULL string type values in a flow with an empty string,
    so I've set up variable through java script
    setVariable("DummyStr","","s")
    in a [if fields value is null] I've checked select value type and put in replace by value ${DummyStr}

    simple test transformation looks like this

    dummy.jpg

    when I'm running this transformation from spoon the log output is correct

    2012/05/02 16:25:36 - Spoon - Transformation opened.
    2012/05/02 16:25:36 - Spoon - Launching transformation [dummy]...
    2012/05/02 16:25:36 - Spoon - Started the transformation execution.
    2012/05/02 16:25:36 - dummy - Dispatching started for transformation [dummy]
    2012/05/02 16:25:36 - Transformation metadata - Natural sort of steps executed in 1 ms (4 time previous steps calculated)
    2012/05/02 16:25:36 - Generate Rows.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
    2012/05/02 16:25:36 - SetEmptyStr.0 - Optimization level set to 9.
    2012/05/02 16:25:36 - Write to log.0 -
    2012/05/02 16:25:36 - Write to log.0 - ------------> Linenr 1------------------------------
    2012/05/02 16:25:36 - Write to log.0 - id = null
    2012/05/02 16:25:36 - Write to log.0 - field1 = Field One
    2012/05/02 16:25:36 - Write to log.0 - field2 =
    2012/05/02 16:25:36 - Write to log.0 - field3 =
    2012/05/02 16:25:36 - Write to log.0 - field4 =
    2012/05/02 16:25:36 - Write to log.0 -
    2012/05/02 16:25:36 - Write to log.0 - ====================
    2012/05/02 16:25:36 - SetEmptyStr.0 - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
    2012/05/02 16:25:36 - If field value is null.0 - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
    2012/05/02 16:25:36 - Write to log.0 - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
    2012/05/02 16:25:36 - Spoon - The transformation has finished!!

    when I'm doing it from pan.sh on my ubuntu I'm getting following output

    root@qa-db-report:~/app/data-integration# ./pan.sh -user=admin -pass=admin -rep=7 -dir=/ -trans=dummy
    INFO 02-05 16:25:22,052 - Pan - Start of run.
    INFO 02-05 16:25:22,156 - RepositoriesMeta - Reading repositories XML file: /root/.kettle/repositories.xml
    INFO 02-05 16:25:23,317 - dummy - Dispatching started for transformation [dummy]
    INFO 02-05 16:25:23,353 - Generate Rows - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
    INFO 02-05 16:25:23,569 - Write to log -
    ------------> Linenr 1------------------------------
    id = null
    field1 = Field One
    field2 = ${DummyStr}
    field3 = ${DummyStr}
    field4 = ${DummyStr}


    ====================
    INFO 02-05 16:25:23,587 - SetEmptyStr - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
    INFO 02-05 16:25:23,597 - If field value is null - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
    INFO 02-05 16:25:23,617 - Write to log - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
    INFO 02-05 16:25:23,617 - Pan - Finished!
    INFO 02-05 16:25:23,617 - Pan - Start=2012/05/02 16:25:22.053, Stop=2012/05/02 16:25:23.617
    INFO 02-05 16:25:23,618 - Pan - Processing ended after 1 seconds.
    INFO 02-05 16:25:23,620 - dummy -
    INFO 02-05 16:25:23,620 - dummy - Step Generate Rows.0 ended successfully, processed 1 lines. ( 1 lines/s)
    INFO 02-05 16:25:23,620 - dummy - Step SetEmptyStr.0 ended successfully, processed 1 lines. ( 1 lines/s)
    INFO 02-05 16:25:23,620 - dummy - Step If field value is null.0 ended successfully, processed 1 lines. ( 1 lines/s)
    INFO 02-05 16:25:23,620 - dummy - Step Write to log.0 ended successfully, processed 1 lines. ( 1 lines/s)
    root@qa-db-report:~/app/data-integration#

    for some reason IF NULL step does not accept ${DummyStr} variable

    Do you think I miss something ?

  2. #2
    Join Date
    Mar 2011
    Posts
    257

    Default

    Not sure why you are using a variable in this case. But you haven't set the variable when executing with pan.
    you have to add
    -paramummyStr=""

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •