Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with loop and reading from Active Directory

Hi,

i want to read the e-mail adresses from Active Directory. The connection works good, when i type a person name and surname it gives me his/her e-mail adress. But i have a problem with a loop which gets the name and surname from excel and then asks the active direcotry for e-mail.

My loop looks like this:

LET rowTextMail = NoOfRows('PM');

for i=1 to rowTextMail

         let firstName = chr(39)&'%'&mid(FieldValue('op_name_pm',$(i)), 1, Index(FieldValue('op_name_pm',$(i)), ' '))&'%'&chr(39);

         let surName   = chr(39)&'%'&mid(FieldValue('op_name_pm',$(i)), Index(FieldValue('op_name_pm',$(i)), ' ')+1)&'%'&chr(39) ; 

           

ADReportPM:

    LOAD

        userPrincipalName as mail_pm,

        sn as sn_pm

    ;

    SQL select

        userPrincipalName, sn, givenName

        FROM 'LDAP://xxxxxxx'  WHERE sn=$(surName) AND givenName=$(firstName);

    next

I've checked and firstName and surName give me perfect name and surname, but when i loop i get nothing.

But when i type:

FROM 'LDAP://xxxxxxx'  WHERE sn='Nowak' AND givenName='Piotr';

it works...

Where is the problem? I've tried diffrent types of passing the variables: WHERE sn='$(surName)' AND givenName='$(firstName)'; but none of them worked...

1 Reply
Not applicable
Author

I have the same problem, something is wrong with passing the variable ...