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

1 Like

This will get you today’s date:

image

Subtracting 1-year… :man_shrugging:

2 Likes

looks like 58 other people have the same question…

3 Likes

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

2 Likes

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.

3 Likes

#_'(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.

9 Likes

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

9 Likes

An Epicor Function? Or something else?

Epicor

2 Likes

Me and David almost had it lol.

1 Like

we tried anyway. close but no cigar.

1 Like

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

2 Likes

That’s how I got all my points.

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

2 Likes

It being her formula of course

Sliding Tom Cruise GIF by HULU

1 Like