pmfith
pmfith

Reputation: 909

How to use a date constant for a BQL query filter

I'm trying to get a recordset via a BQL query, but I can't figure out how to create a constant for a date. I'd like to filter based on a hard date value - but I see no examples anywhere for a date constant. I tried using a string constant with the date value, but that did not work, and if I try to use a DateTime as such:

public const DateTime TranDate = Convert.ToDateTime("2017-04-01");

public class tranDate : Constant<DateTime>
{
    public tranDate() : base(TranDate) { }
}

I get an error - "cannot declare instance members in a static class".

I'm at a loss on this one...

Upvotes: 1

Views: 1679

Answers (1)

Hugues Beaus&#233;jour
Hugues Beaus&#233;jour

Reputation: 8288

Try the following syntax to declare your date constant:

public class myDate : Constant<DateTime>
{
    public myDate()
        : base(new DateTime(2017, 04, 01))
    {
    }
}

For details see Acumatica BQL constants reference

Upvotes: 3

Related Questions