Hitachi Vantara Pentaho Community Forums
Results 1 to 11 of 11

Thread: Can I use input fields with an LDAP input object?

  1. #1
    Join Date
    Dec 2007
    Posts
    11

    Default Can I use input fields with an LDAP input object?

    Can I create a dynamic filter in and LDAP input object using an input field?

    The scenario is - I want to flatten an LDAP tree. I would like to use one LDAP object to query for the first level of entries and then a second object to query for all the entries under each of the results from the first search. For instance, it the first search return a list of entries for which the DN is dn: uid=XYZ,... I would like the filter in the 2nd LDAP object to be (&(!(uid=*))(uid:dn:=<the uid from the first query>)).

    If it is not possible, is there any other way to do that? I'm seeking for a scalable solution for a very large tree...

    Yoel

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    It will require a 2-step process if you understand you requirements correctly.

    Do the first level and output them to e.g. a file (possibly adding some small bits to it)
    Read the file and set up variables to be used in the LDAP input step.

    Regards,
    Sven

  3. #3
    Join Date
    Dec 2007
    Posts
    11

    Default

    How can I construct the LDAP filter using the input values?

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    With javascript step e.g. already adding the "bits" you need to make a filter out of the output. You would need to run a general LDP query, the output of which you can transform into a new filter using JavaScript snippets and then running a new transformation/LDAP input using the output of the previous as search filter.

    Regards,
    Sven

  5. #5
    Join Date
    Dec 2007
    Posts
    11

    Default

    I'm missing something which is probably basic - how can I use an input field name as the LDAP filter? for instance, if I have an input field named filter holding the entire filter string, I can't just use filter.getValue().
    What is the correct way to do it?

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    Set it up as a variable.

    Regards,
    Sven

  7. #7
    Join Date
    Dec 2007
    Posts
    11

    Default

    How should I use the variable (yes I know the ${var} thing) ?
    I need the second type of query to be performed for each row that the first query product.
    For instance, let's assume that I configured the first LDAP step to return only "uid" and I create a small script to produce the filter.
    The first query returns three rows: uid=user1, uid=user2, uid=user3.
    Now I want to create three filters:
    (uid:dn:=user1), (uid:dn:=user2), (uid:dn:=user3).
    Each of these filters may return many entries.
    I need to use the result set from (uid:dn:=user1), collect attributes form all, combine it with the first result from the original query and create a new LDAP entry. This process should repeat for the rest of the entries.
    It look more complex...

    Yoel

  8. #8
    Join Date
    May 2006
    Posts
    4,882

    Default

    The long story..

    main job executing

    1) transformation that execute your first LDPA filter resuling int rows:
    uid=user1
    uid=user2
    uid=user3

    followed by javascript to make it into:
    (uid:dn:=user1)
    (uid:dn:=user2)
    (uid:dn:=user3).

    Then pass the rows to result

    2) excutes another job that has 2 sub transformations (and the job itself runs for each row)

    2a) a simple transformation that gets input from result and sets a variable using "set variable", variable FILTER could be set to "(uid:dn:=user1)" e.g.
    2b) a transformation that uses LDAP again now using the filter condition with the variable set up in 2a) writing the output to wherever.

    That should do the trick, if everything else works ok (I haven't tried LDAP myself e.g.)

    Regards,
    Sven

  9. #9
    Join Date
    Dec 2007
    Posts
    11

    Default

    How using the intermediate "result" changes anything? Why must step 2 become a separate job?

    Yoel

  10. #10
    Join Date
    May 2006
    Posts
    4,882

    Default

    Quote Originally Posted by yoeljacobsen View Post
    How using the intermediate "result" changes anything? Why must step 2 become a separate job?
    Try it... you need the intermediate result as you can't do it in one go, and the 2 jobs are required so that you can execute "for each row" ... it's a kind of looping in Kettle which doesn't work if you have only 1 job.

    If you want to see something similar (with tables instead of LDAP) look at the "process all tables" example under the samples directory.

    Regards,
    Sven

  11. #11
    Join Date
    Dec 2007
    Posts
    11

    Default

    Got it. Thanks!

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.