John
John

Reputation: 1

How do I default the current date in a Acumatica Generic Query?

How do I default the current date in a Acumatica Generic Query? The date needs to default to the current date and not a hard coded specfic date.

Upvotes: 0

Views: 1369

Answers (2)

Yuriy Zaletskyy
Yuriy Zaletskyy

Reputation: 5151

I propose you to override your query in Graph. For example

public class YourGraph : PXGraph<YourGraph>
{
     public PXSelect<YourDac> Query;

     public IEnumerable query()
     {
         DateTime tod = DateTime.Now;
         var result = PXSelect<YourDac,Where<YourDac.DateTimeField,Equal<Required<YourDac.DataTimeField>>>>.Select(this, tod);
         return result;
     }
}

Acumatica will substitute required part with tod value

Upvotes: 1

Ali
Ali

Reputation: 113

For parameters, unfortunately you can only specify specific dates only. For columns that show up on the results you can use expressions such as =Today()

For parameters, one possible solution based on your scenario is to leave it blank and in your Conditions check for null and use expressions to replace Null with =Today().. so if the user leave the field blank you return records that are based on today/etc..

Upvotes: 0

Related Questions