Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: LDAP Update with null values

  1. #1
    Join Date
    Mar 2016
    Posts
    5

    Default LDAP Update with null values

    Hello,

    When using an LDAP update with a null value, is there a way to have it skip the null and not update? For example if an attribute is null and in the Active Directory there is a value, can I have it not change that value to null?

    Thanks!

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    You can use a User-Defined-Java-Expression for this:



    Name:  UDJE.jpg
Views: 403
Size:  16.9 KB
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Mar 2016
    Posts
    5

    Default

    Quote Originally Posted by marabu View Post
    You can use a User-Defined-Java-Expression for this:



    Name:  UDJE.jpg
Views: 403
Size:  16.9 KB

    Thank you for the response. Lets say that the old and the new are both null. Is there a way for this to run correctly? The solution you give me works on all cases besides if both old/new are null.

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    What exactly is happening when old and new value are null?
    Is there an exception thrown?
    What does the log line for your LDAP-Output step look alike, the one for "Finished processing"?
    So long, and thanks for all the fish.

  5. #5
    Join Date
    Mar 2016
    Posts
    5

    Default

    When I update with a null value, I get the following:

    2016/03/22 09:44:58 - Update Preferred Name.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : Unexpected error
    2016/03/22 09:44:58 - Update Preferred Name.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : org.pentaho.di.core.exception.KettleException:
    2016/03/22 09:44:58 - Update Preferred Name.0 - ERROR (version 4.2.1-stable, build 15952 from 2011-10-25 15.27.10 by buildguy) : Field [currentField] couldn't be found in the input stream!

  6. #6
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    I bet there's no connection between that exception and the update functionality of the LDAP-Output step.
    The error message clearly states that currentField does not exist where you want to use it.
    Did you check the fields available for the step that is throwing the exception?
    You can use action "Show input fields" from the step menu for this.
    So long, and thanks for all the fish.

  7. #7
    Join Date
    Mar 2016
    Posts
    5

    Default

    Quote Originally Posted by marabu View Post
    I bet there's no connection between that exception and the update functionality of the LDAP-Output step.
    The error message clearly states that currentField does not exist where you want to use it.
    Did you check the fields available for the step that is throwing the exception?
    You can use action "Show input fields" from the step menu for this.

    Here is the path to the update:

    User Defined Java Expression -> Select Values -> LDAP Output

    The User Defined Java Expression has the following java command: X==null?Y:X Where X and Y are different variables.

    This Transformation is running 5000+ entries to update and sometimes X and Y are both null. This means when it gets passed to the LDAP Output and I try to update, it throws an error because the stream is Null. In the example I gave you above with currentField, when entering the LDAP Output it was null and throws an error because in the "Show input field" currentField is supposed to be updated.

    So my issue is, I have a set amount of attributes in the "Show input fields" of the LDAP output and when one of those attributes has both X and Y null, it enters the LDAP Output to Update and can't because it is null. And to be clear, if currentField is not a null value it updates correctly.

    Is there a way to bypass a null value or dynamically change the attributes in the "Show input field" section of the Output LDAP to that a null value does not get updated?

  8. #8
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    I installed an LDAP server to reproduce your problem using 5 test cases and all tests with LDAP-Output were successful.
    I'm not using the same Kettle version as you, so there's a remote chance of a bug, but I doubt it.
    If you provide a runnable test case I will try to reproduce the error on my machine.
    So long, and thanks for all the fish.

  9. #9
    Join Date
    Mar 2016
    Posts
    5

    Default

    Quote Originally Posted by marabu View Post
    I installed an LDAP server to reproduce your problem using 5 test cases and all tests with LDAP-Output were successful.
    I'm not using the same Kettle version as you, so there's a remote chance of a bug, but I doubt it.
    If you provide a runnable test case I will try to reproduce the error on my machine.

    I created a Test case but do not know how to link it?

    Also, if you have a null value being passed to the LDAP output, it passes?

  10. #10
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    My test cases where using an existing entry's description attribute:

    present value new value
    null null
    null "test"
    "test" "test"
    "test" "case"
    "case" null

    Run in the given order they produce the correct snapshots and no error at all.

    BTW: You should be able to attach your transformation using the advanced editor.
    So long, and thanks for all the fish.

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
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

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