AML search with parameter

Is there any way to add the current date , as dynamic parameter into the AML search? I want to do something like this: <aer_date condition="le">@today</aer_date> <aer_date_end condition="ge">@today</aer_date_end>    
  • Hello, This kind of dynamic parameter isn't yet supported in the standard AML Search, but you could write a custom Server Method that does this kind of replacement. You could then call that Server Method by passing the name into the action of your AML query like <Item type="Part" action="My Custom Get"/>. The example code below is a rough demonstration of what this method could look like.
    // Change the action to a real get
    // Get today's date in the appropriate format
    string todaysDate = DateTime.Now.ToString("yyyy-MM-dd");
    // Perform a raw string replacement of the @today variable and today's date
    string updatedAml = "<AML>" + this.dom.OuterXml.Replace("@today", todaysDate) + "</AML>";
    return this.getInnovator().applyAML(updatedAml);
    If you'd like to run a search on the current date and time you can instead use a format like: yyyy-MM-ddTHH:mm:ss Chris
    Christopher Gillis Aras Labs Software Engineer
  • Another approach would be to write an onBeforeGet for the ItemType and convert a known value to today's date as above. edit: by picking a date such as "1/1/1900" your usersĀ could then use simple search and you could create them a saved search with this value.