• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • 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

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    LDAP Query Syntax help

    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 by chef; 8 February 2012, 14:07.
    The proud owner of 125 Xeno Geek Points

    #2
    Originally posted by chef View Post
    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?
    If your company is the best place to work in, for a mere £500 p/d, you can advertise here.

    Comment


      #3
      Originally posted by pmeswani View Post
      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.
      The proud owner of 125 Xeno Geek Points

      Comment


        #4
        Check your PMs
        Last edited by doodab; 8 February 2012, 14:36.
        While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.'

        Comment


          #5
          Originally posted by chef View Post
          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.
          Best Forum Advisor 2014
          Work in the public sector? You can read my FAQ here
          Click here to get 15% off your first year's IPSE membership

          Comment


            #6
            is it in a script?

            Could the script generate the appropriate date translate it into a timestamp and put that into the ldap query.
            merely at clientco for the entertainment

            Comment


              #7
              Originally posted by eek View Post
              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
              The proud owner of 125 Xeno Geek Points

              Comment

              Working...
              X