Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Adding output dynamic fields in UDJC component

  1. #1
    Join Date
    Aug 2016
    Posts
    14

    Default Adding output dynamic fields in UDJC component

    I would like if is possible adding fields in "Fields tabs" through java code.

    I pretend increasing columns of result row.

    Name:  dynamic_output.jpg
Views: 108
Size:  19.7 KB

    Thanks for help me

  2. #2
    Join Date
    May 2014
    Posts
    358

    Default

    In the Fields tab, fill in the information about the new fields. From the code, you assign the values like this:

    Code:
    Object[] outputRow = createOutputRow(r, data.outputRowMeta.size());
    get(Fields.Out, "SRC_CREATE_TS").setValue(outputRow, lastCreate);
    get(Fields.Out, "SRC_MODIFY_TS").setValue(outputRow, lastModify);
    get(Fields.Out, "MAX_DWH_LOAD_TS").setValue(outputRow, lastDwhLoad);
    putRow(data.outputRowMeta, outputRow);
    (this example creates three new fields in the stream: SRC_CREATE_TS, SRC_MODIFY_TS, MAX_DWH_LOAD_TS)

  3. #3
    Join Date
    Aug 2016
    Posts
    14

    Default

    Quote Originally Posted by Lukfi View Post
    In the Fields tab, fill in the information about the new fields. From the code, you assign the values like this:

    Code:
    Object[] outputRow = createOutputRow(r, data.outputRowMeta.size());
    get(Fields.Out, "SRC_CREATE_TS").setValue(outputRow, lastCreate);
    get(Fields.Out, "SRC_MODIFY_TS").setValue(outputRow, lastModify);
    get(Fields.Out, "MAX_DWH_LOAD_TS").setValue(outputRow, lastDwhLoad);
    putRow(data.outputRowMeta, outputRow);
    (this example creates three new fields in the stream: SRC_CREATE_TS, SRC_MODIFY_TS, MAX_DWH_LOAD_TS)

    for doing that "SRC_CREATE_TS", "SRC_MODIFY_TS" and "MAX_DWH_LOAD_TS", shouldn't be declared in Field Tab?

  4. #4
    Join Date
    May 2014
    Posts
    358

    Default

    Yes, they have to be declared there, that's I wrote in my post.

  5. #5
    Join Date
    Aug 2016
    Posts
    14

    Default

    Quote Originally Posted by Lukfi View Post
    Yes, they have to be declared there, that's I wrote in my post.
    I wanted a way without declaring variables there. But I found another solution already

  6. #6
    Join Date
    May 2014
    Posts
    358

    Default

    That's great, how did you do it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.