Constant.Today - 1 year ? How

Greetings all,

I need a little help translating this :
DateTime.Now.AddYears(-1) ------ SQL
or
DATEADD(yy,-1,Constant.Today ------ BAQ Speak

to something that will work in App Studio here

Is it JSON ( as the ‘Editor’ suggests) ? ( via the pencil icon)
image

or another Epicoreze syntax ?

I am using a Datepicker in a Dashhboard to provide parameters for a BAQ which in turn feeds a grid on said dashboard.

Thanks

Dean

This will get you today’s date:

image

Subtracting 1-year… :man_shrugging:

looks like 58 other people have the same question…

Please @hmwillett !!! For you it would be an easy answer ??

This may sound silly, and I’m all for logic to be ran server-side, so could you make a simple function to do this calculation and return it back to the app? I know it seems like more effort for a trivial thing lol

True, especially for a default value on a form…/ dashboard…

I made a similar function for a dashboard default date … and even though it’s yet another call to the server, it’s a super simple function, so it’s super fast. On our system the response is back before the dashboard BAQ is finished running.

#_'(new Date(new Date().getFullYear() - 1, new Date().getMonth(), new Date().getDate())).toLocaleDateString()'_#

JavaScript is gross. Do what @jwphillips said and make a function. I have a library called “HelperFuncs” for stuff like this. Little one-liners and whatnot.

Thank you so Much Hanna !!!
Really appreciated, sorry I had to tag you.

Dean

Say it 3 times next time. I wanna be the new Beetlejuice.

Tim Burton Yes GIF by Freeform

An Epicor Function? Or something else?

Epicor

Me and David almost had it lol.

we tried anyway. close but no cigar.

we were very close :people_hugging:

Don’t get to excited, I have such confidence in Hanna that I marked it solved without even trying it…

Thinking Think GIF by Rodney Dangerfield

That’s how I got all my points.

Half my stuff don’t work, but people forget and never try stuff :rofl:

It being her formula of course

Sliding Tom Cruise GIF by HULU

1 Like