How to know which view a user is in?

Notes on our latest calendar for FileMaker 13,: DayBack
Posts: 82
Joined: Fri Jul 17, 2009 7:44 am
PostPosted: Thu Jun 25, 2020 8:03 am
I want to have certain fields display in an event that will depend on which view a user is currently in. For instance, when a user is accessing the Week Schedule view I want them to see some field and when they are in the Resources Schedule I want to show them other fields. Is there a global variable or some other means that I can leverage here? If not, do you think this is possible to create and track?
SeedCode Staff
SeedCode Staff
Posts: 335
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Thu Jun 25, 2020 8:46 am
Hi Jim,

In DayBack Classic, there is no trigger to run JavaScript or FileMaker scripts when these things happen.

However, in the new DayBack for FileMaker 19 and DayBack Online, you can accomplish these things using custom app actions: https://docs.dayback.com/article/140-custom-app-actions

App actions will let you trigger JavaScript or FileMaker scripts whenever something like the view is changed, calendar loaded, filters applied, etc. This will allow you to take these actions to customize the behavior when these things happen.

I hope that helps!

KC
Posts: 82
Joined: Fri Jul 17, 2009 7:44 am
PostPosted: Thu Jun 25, 2020 11:01 am
We're not ready to work with 19 yet (not with the current project I'm working on) and I do need some way to distinguish between layouts. :cry:

I kind of had this idea in mind: I assume when the user clicks a link to change view modes of the calendar, global fields in the CalendarInterface table get populated with data to be exported to the /var/ directory. Would it be possible to check these global field just prior to exporting for the presence of a word or code or comment pattern that would distinguish between the different layouts. Afterall this HTML/Javascript code must be different to enable the webviewer to draw the different screens when requested. Any thoughts on that approach? :D
SeedCode Staff
SeedCode Staff
Posts: 335
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Thu Jun 25, 2020 11:22 am
Hi Jim.

When you click a button to change views, the calendar knows you're in this view and saves it as a variable in the javascript session, so FileMaker doesn't know that. If the calendar needs to fetch the new events, it does so, but FileMaker only knows the date range that the calendar is fetching events for ($$sc_DateRangeStartAutoGlobNum and $$sc_DateRangeEndAutoGlobNum). You could use these values to guess which view the user is on, but you wouldn't know the difference between the week schedule, list, or a resource view showing 7 days, for example. So it's probably not that useful. FileMaker doesn't have any feedback about the specific view the user is in.

Additionally, this would only work if you disable lazy fetching in the "Webviewer Settings" script. Lazy fetching means the calendar won't necessarily query events if you are in week view and switch to day view, since it already has the data for that time range. Turning off lazy fetching means the calendar will re-query data any time you change views, which might make the calendar a bit slower.

Regards,

KC
Posts: 82
Joined: Fri Jul 17, 2009 7:44 am
PostPosted: Thu Jun 25, 2020 11:29 am
Ah. I was afraid you might say that. In that case I'll need to change my plans a bit. Thanks for the input. Always appreciated.

Return to DayBack Calendar for FileMaker

Who is online

Users browsing this forum: No registered users and 8 guests

cron
(855) SEEDCODE
support@seedcode.com
Follow us: