• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

LDAP Query Syntax help

chef

Godlike
Thanks received
43
I am trying to construct the correct syntax for an LDAP query. At present I have

Code:
ldap://clientaddress.com/o=client.com?uid?sub?(&(objectclass=clientperson)(clientmetalink=ITDESK)(modifytimestamp>=20120110000000Z))

which pulls all people records modified after 10th Jan 2012.

This works fine, however the modifytimestamp query is fixed.

I am trying to replace the fixed timestamp 20120110000000Z with a calculated variable of something like 'today - 3 days' using any inbuilt operators/variables LDAP has (that's the bit I can't find out).

e.g
Code:
ldap://clientaddress.com/o=client.com?uid?sub?(&(objectclass=clientperson)(clientmetalink=ITDESK)(modifytimestamp>=currentDate -3 days))

Does anyone have any ideas on the correct LDAP syntax for this? Is it even possible?
 
Last edited: 14:01
I am trying to construct the correct syntax for an LDAP query. At present I have

Code:
ldap://clientaddress.com/o=client.com?uid?sub?(&(objectclass=clientperson)(clientmetalink=ITDESK)(modifytimestamp>=20120110000000Z))

which pulls all people records modified after 10th Jan 2012.

This works fine, however the modifytimestamp query is fixed.

I am trying to replace the fixed timestamp 20120110000000Z with a calculated variable of something like 'today - 3 days' using any inbuilt operators/variables LDAP has (that's the bit I can't find out).

e.g
Code:
ldap://clientaddress.com/o=client.com?uid?sub?(&(objectclass=clientperson)(clientmetalink=ITDESK)(modifytimestamp>=currentDate -3 days))

Does anyone have any ideas on the correct LDAP syntax for this? Is it even possible?

Stupid suggestion coming up. Does (currentDate - 3 days) work? (I.e. put the maths inside brackets). Also, can you pass a temporary variable to the modifytimestamp query? i.e. modifytimestamp>=notCurrentDate?
 
Stupid suggestion coming up. Does (currentDate - 3 days) work? (I.e. put the maths inside brackets). Also, can you pass a temporary variable to the modifytimestamp query? i.e. modifytimestamp>=notCurrentDate?

the 'currentDate - 3 days' is simply an english description of what I'm trying to calculate, I don't think LDAP is that clever is it?

and no, no chance to pass a temp variable, that was my first line of thought.

Thanks for the suggestion though.
 
I am trying to construct the correct syntax for an LDAP query. At present I have

Code:
ldap://clientaddress.com/o=client.com?uid?sub?(&(objectclass=clientperson)(clientmetalink=ITDESK)(modifytimestamp>=20120110000000Z))

which pulls all people records modified after 10th Jan 2012.

This works fine, however the modifytimestamp query is fixed.

I am trying to replace the fixed timestamp 20120110000000Z with a calculated variable of something like 'today - 3 days' using any inbuilt operators/variables LDAP has (that's the bit I can't find out).

e.g
Code:
ldap://clientaddress.com/o=client.com?uid?sub?(&(objectclass=clientperson)(clientmetalink=ITDESK)(modifytimestamp>=currentDate -3 days))

Does anyone have any ideas on the correct LDAP syntax for this? Is it even possible?

It should be possible to do it - this example shows how to do it in VB, but it doesn't look too different from the format that you are passing in.
 
is it in a script?

Could the script generate the appropriate date translate it into a timestamp and put that into the ldap query.
 
is it in a script?

Could the script generate the appropriate date translate it into a timestamp and put that into the ldap query.

yes eek that's the solution, shortly pipped to the post by Doodab.

problem solved

ARDBC LDAP plugin vendor form lookup
if you add the modified timestamp as a field to the vendor form and use it in a remedy query that does e.g. a set fields from the form, the plugin should do the necessary maths before retrieving the data.

fantastic all, many thanks from preventing an ageing chef going even more senile :yay:
 

Advertisers

Back
Top