# I believe I may be using parameters incorrectly

**URL:** <https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379>\
**Category:** Procedures & APOC\
**Created:** [October 11, 2018, 5:06pm UTC](https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379 "2018-10-11T17:06:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdrangeid](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/pdrangeid/32/7914_2.png) [@pdrangeid](https://community.neo4j.com/u/pdrangeid)\
**Post date:** [October 11, 2018, 5:06pm UTC](https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379/1 "2018-10-11T17:06:14Z")

</div>

Attempting to perform a nested apoc.load.ldap

1st query (return all domain controllers and their DNS name) (this works fine!)

2nd query take each domain controller, connect to it, and query the lastlogon property for users on that domain controller. (then use this to create [:LOGGED\_ON] relationships between LDAP users and domain controllers). I don't think I'm properly parameterizing the resulting values for use in the 2nd apoc.local.ldap call. Here's my code:

```auto
call apoc.load.ldap({ldapHost:'edc-dc3.mydomain.com',loginDN:'cn=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com',loginPW:'MyPassw0rd'},
{searchBase:'ou=Domain Controllers,dc=mydomain,dc=com',searchScope:'SCOPE_SUB',
attributes:['dn','dNSHostName'],
searchFilter:'(&(objectCategory=computer)(objectClass=computer)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'})
yield entry as dc
with dc
:params {ldapprops: [{ldapHost: dc.dNSHostName, loginDN: "n=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com", loginPW: "MyPassw0rd"}]}
call apoc.load.ldap(ldapprops,{searchBase:'ou=Hosted,dc=mydomain,dc=com',searchScope:'SCOPE_SUB',attributes:['userPrincipalName','LastLogon','userAccountControl'],
searchFilter:'(&(samAccountType=805306368))'})
yield entry as user
return user

```

The error I'm getting is:  
Neo.ClientError.Statement.SyntaxError: Invalid input 'c': expected whitespace, comment or a relationship pattern (line 8, column 1 (offset: 580))  
"call apoc.load.ldap(ldapprops,{searchBase:'ou=Hosted,dc=mydomain,dc=com',searchScope:'SCOPE\_SUB',attributes:['userPrincipalName','LastLogon','userAccountControl'],"  
^

---

<div class="post-metadata">

**Author:** ![michael.hunger](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/michael.hunger/32/27377_2.png) [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Post date:** [October 12, 2018, 12:20am UTC](https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379/2 "2018-10-12T00:20:46Z")

</div>

The params line in between is wrong, you have to call params in its own separate browser command:  
Note that what you pass there is JSON. (There is an alternative syntax where you pass Cypher expressions instead).

```auto
:params {"ldapprops": {"ldapHost":"edc-dc3.mydomain.com", "loginDN":"cn=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com","loginPW":"MyPassw0rd"}} 

```

alternative:

```auto
:param ldapprops => {ldapHost:'edc-dc3.mydomain.com',loginDN:'cn=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com',loginPW:'MyPassw0rd'}

```

and only after use them in your query with `$ldapprops`

What you're probably looking for is to declare a new variable within the query with `WITH`. See below.

```auto
call apoc.load.ldap($ldapprops,
{searchBase:'ou=Domain Controllers,dc=mydomain,dc=com',searchScope:'SCOPE_SUB', 
attributes:['dn','dNSHostName'], 
searchFilter:'(&amp;(objectCategory=computer)(objectClass=computer)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'}) 
yield entry as dc 

WITH {ldapHost: dc.dNSHostName, loginDN: "n=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com", loginPW: "MyPassw0rd"} as dcConnection

call apoc.load.ldap(dcConnection, {searchBase:'ou=Hosted,dc=mydomain,dc=com',searchScope:'SCOPE_SUB',attributes:['userPrincipalName','LastLogon','userAccountControl'], searchFilter:'(&amp;(samAccountType=805306368))'}) 
yield entry as user 
return user

```

---

<div class="post-metadata">

**Author:** ![ted](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ted/32/137_2.png) [@ted](https://community.neo4j.com/u/ted)\
**Post date:** [November 11, 2018, 12:19am UTC](https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379/3 "2018-11-11T00:19:15Z")

</div>

I'm using Neo4j Desktop 1.1.9 and Neo4j 3.4.4 and I'm unable to set multiple params in the same query. I used to be able to do this. I have numerous params that affect all of my queries. How do I do this? I tried Michael's suggestion above and unable to get this to work. The only way I can make this work is to create and save individual :param queries which is extremely inefficient and inconvenient. Any ideas or is this no longer possible?  
Thanks!

---

<div class="post-metadata">

**Author:** ![andrew\_bowman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/andrew_bowman/32/73_2.png) [@andrew\_bowman](https://community.neo4j.com/u/andrew_bowman)\
**Post date:** [November 12, 2018, 6:22pm UTC](https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379/4 "2018-11-12T18:22:37Z")

</div>

It's possible, just there's something weird going on with the parsing. If you remove the outermost brackets it should work:

```auto
:params "ldapprops": {"ldapHost":"edc-dc3.mydomain.com", "loginDN":"cn=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com","loginPW":"MyPassw0rd"}

```

---

<div class="post-metadata">

**Author:** ![andrew\_bowman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/andrew_bowman/32/73_2.png) [@andrew\_bowman](https://community.neo4j.com/u/andrew_bowman)\
**Post date:** [November 12, 2018, 10:16pm UTC](https://community.neo4j.com/t/i-believe-i-may-be-using-parameters-incorrectly/2379/5 "2018-11-12T22:16:16Z")

</div>

Update on this, it has been fixed with browser version 3.2.11, so if you're using the browser that comes with Neo4j Desktop you should be up to date (or be able to update the app so you use the latest browser version).

However the browser that comes with Neo4j 3.4.9 is only 3.2.10, so if you're just using the browser provided by this version (or prior) then it's still affected.
