Johnboll
Johnboll

Reputation: 55

Acumatica, creating a generic inquiry with a condition on a field equal to the previous day


I have created a simple generic inquiry that shows some data after joining two tables. I am now struggling to implement a condition that should make the result only contain rows where a date field is equal to yesterday date.
I am a bit annoyed as Acumatica has created the method `today()` neatly, but not a `yesterday()` or `tomorrow()`.
Does anyone have a good solution that they care to share?

Help is much appreciated, Cheers.


P.s
I have made this very hackish solution that somewhat works, but breaks between change in month or year. =CStr(Year(Today()))+CStr(Month( Today() ))+CStr( Day(Today())-1)

Upvotes: 0

Views: 1647

Answers (2)

Samvel Petrosov
Samvel Petrosov

Reputation: 7706

You can simply write Equals to @Today-1 for Yesterday like below:

enter image description here enter image description here

Upvotes: 1

Johnboll
Johnboll

Reputation: 55

Okay, so I found the solution to my problem!
I read that Acumatica is coded C# and.NET which made me think of how adding dates is done there. You utilise the DateAdd(date, interval, number) under the time tab to create relative changes to date.
In this case, the date is the time source from where you want to change, interval is in which interval/dimension you wanna move, for example, 'd' is for days. You can find more prefixes here: crosspost. Lastly, number is how much you want to change in the interval, in my case -1.

TLDR; Use DateAdd(Today(), 'd', -1) to get the previous date in relation to the current date.

Upvotes: 2

Related Questions