Page 1 of 1

Reading the date currently displayed by DayBack?

PostPosted: Sat May 12, 2018 3:56 pm
by wsmiii
Quick question -

I need to retrieve and use the date that is the current focus of the DayBack calendar display - the date of the day displayed by the vertical resource view, and the date of the first day of the week displayed by the week view.

Of course, that date changes as I move from day to day or week to week.

Where can I read that date?

Thanks!

Re: Reading the date currently displayed by DayBack?

PostPosted: Mon May 14, 2018 9:51 am
by kcembrey
Hi wsmiii,

While we don't save the current focus date in any variables, you can retrieve the start and end date range with the variables "$$sc_DateRangeStartAutoGlobNum" and "$$sc_DateRangeEndAutoGlobNum".

I'd love to hear your use-case scenario for reading the current focus date in the calendar. If it's something you feel that is necessary for the functionality of your solution, we can add it as a feature-request to be implemented in a future build of DayBack.

Regards,

KC

Re: Reading the date currently displayed by DayBack?

PostPosted: Sun May 27, 2018 6:29 am
by wsmiii
Thanks for those variables. I knew the value must be visible somewhere.

My users designate alternating weeks as "Week 1" versus "Week 2," because their routines vary depending upon which week it is. Schedulers wanted "Week 1" or Week 2" displayed on the Calendar to make scheduling easier.

I didn't think "Getweekofyear" would work because our weeks go right on alternating across the year boundaries. GetWeekOfYear resets at the beginning of each year, which can throw this off.

So I used your suggested variable in the following calculation:

Mod ( Truncate ( (($$sc_DateRangeStartAutoGlobNum - 6361884800) / 604800) ; 0 ); 2)

Which returns a 0 or 1 on alternating weeks.

6361884800 is the number of seconds from 1/1/1900 to 1/1/2017 (used because Jan 1 fell on a Monday).The calc divides the number of seconds since 1/1/2017 by the number of seconds in a week, truncated to a whole number count of the weeks since 1/1/17. The Mod function returns 1 or 0, which I will use to get "Week 1" or Week 2" (as soon as someone gets back to me whether the week of 1/1/17 was a "Week 1" or a "Week 2"). This value will continue alternating properly across year boundaries.

I think it would be cool (and sufficient) if you included information about these variables in your documentation.

Re: Reading the date currently displayed by DayBack?

PostPosted: Tue May 29, 2018 1:03 pm
by kcembrey
Thanks, wsmiii,

Glad using the $$sc_DateRangeStartAutoGlobNum variable worked for you.

I'll get that added into our docs so other users can take advantage of those variables!

Regards,

KC