{"id":10414,"date":"2017-01-27T07:06:37","date_gmt":"2017-01-27T15:06:37","guid":{"rendered":"https:\/\/www.seedcode.com\/?p=10414"},"modified":"2017-01-27T07:06:37","modified_gmt":"2017-01-27T15:06:37","slug":"reporting-dayback-calendar","status":"publish","type":"post","link":"https:\/\/seedcode.com\/reporting-dayback-calendar\/","title":{"rendered":"Reporting with DayBack Calendar"},"content":{"rendered":"<p>Customers often want to track stats about the resources\u00a0they&#8217;re\u00a0scheduling in DayBack. They want to answer questions like&#8230;<\/p>\n<p style=\"padding-left: 30px;\">&#8220;How many hours do these assignments represent?&#8221;<\/p>\n<p style=\"padding-left: 30px;\">&#8220;What is the total cash value of the\u00a0confirmed bookings this week?&#8221;<\/p>\n<p>[ba-box background=&#8221;#98e382&#8243; border=&#8221;#4b9b55&#8243; textcolor=&#8221;#F7F7F7&#8243;]<\/p>\n<p>This kind of reporting is now built into DayBack. \u00a0Check out the new Calendar Analytics introduced in July of 2018: <a href=\"\/calendar-analytics-filemaker\/\" target=\"_blank\" rel=\"noopener\">measure values across your schedule<\/a>.<\/p>\n<p>[\/ba-box]<\/p>\n<p>Stats\u00a0like these\u00a0are easy to add to DayBack and this post describes two different methods for calculating them.<\/p>\n<p>Like many developers, I usually\u00a0think of using relationships first when\u00a0deriving\u00a0date-range stats like these. While that works, I&#8217;ll suggest that <strong>using find requests is much easier and results in code that requires a lot less maintenance as your requirements change<\/strong>. A description of both approaches follows, along with unlocked example files.<\/p>\n<p>In our examples, we&#8217;ll total\u00a0a new field in the events table called &#8220;Cash Value&#8221; and count the number of events in a\u00a0given week.<\/p>\n<h2>Overview<\/h2>\n<p>This short video shows what we&#8217;re trying to accomplish and introduces the two different techniques.<\/p>\n<p><iframe title=\"Reporting in DayBack Calendar\" width=\"960\" height=\"540\" src=\"https:\/\/www.youtube.com\/embed\/Uqyze2aK-w8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/p>\n<p>Step-by-step instructions for each technique follow below in case you&#8217;d like to add this capability to your copy of DayBack. And here are the unlocked example files for each approach&#8230;<\/p>\n<ul>\n<li><a href=\"\/?wpdmdl=41\">Reporting in DayBack Calendar.zip<\/a><\/li>\n<\/ul>\n<p><!--more--><\/p>\n<h2>Using Relationships<\/h2>\n<p>The idea here is to construct a date range relationship that reflect what&#8217;s going on in the calendar, and then use the SUM() or COUNT() functions across that relationship to arrive at the stats you want. To do this, you&#8217;ll need to create a few new fields in the calendar interface table to capture the date range and resource filters currently used in DayBack. These values are cast to global variables while DayBack operates so you just need unstored fields that reflect these global variables. You&#8217;ll see the new fields here in blue:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-large wp-image-10415\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1-1024x866.png\" alt=\"Fields1\" width=\"1024\" height=\"866\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1-1024x866.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1-300x254.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1-768x650.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1-1536x1300.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields1.png 1884w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>You&#8217;ll see a simple global field there as well called &#8220;RangeRefresh&#8221;. That&#8217;s here because FileMaker won&#8217;t know to update the values of our calculated stats just because the global variables change. We need a &#8220;tickler&#8221; field we can modify which will tell FileMaker that something has changed in the relationship and cause our stats to re-evaluate. (If this technique is new to you, here&#8217;s <em>the<\/em>\u00a0overview&#8230; be sure to read the comments:\u00a0https:\/\/www.teamdf.com\/blogs\/ditch-those-flush-caches-use-cartesian-join-instead\/ )<\/p>\n<p>With those fields in place, you can now make a new instance of your events table and create a new relationship to it from CalendarInterface:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-10417\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1-1024x866.png\" alt=\"Relationship1\" width=\"1024\" height=\"866\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1-1024x866.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1-300x254.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1-768x650.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1-1536x1300.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship1.png 1884w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-10418\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2-1024x866.png\" alt=\"Relationship2\" width=\"1024\" height=\"866\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2-1024x866.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2-300x254.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2-768x650.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2-1536x1300.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Relationship2.png 1884w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>If this is starting to seem like a lot of work: you&#8217;re right. Not only aren&#8217;t we quite done yet, but the relationship shown above only accounts for date ranges and resource filters. If you <a href=\"http:\/\/www.seedcode.com\/pmwiki\/index.php?n=DayBackForFileMaker.Filters\" target=\"_blank\" rel=\"noopener\">add new filters to DayBack<\/a>&#8211;which is one of it&#8217;s great strengths&#8211;you&#8217;d have to revisit these fields and relationships for each new filter, adding them to the relationship criterial above. There are even a few more limitations we&#8217;ll discuss in\u00a0the conclusion as well.<\/p>\n<p>But this technique does work, and once the relationship is done we just have to do two more things.<\/p>\n<p>First we need to calculate the stats we&#8217;re interested in, and that means creating two new fields in the CalendarInterafce table and adding them to our calendar layout. These are the fields that actually hold our stats:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-10419\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2-1024x866.png\" alt=\"Fields2\" width=\"1024\" height=\"866\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2-1024x866.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2-300x254.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2-768x650.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2-1536x1300.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields2.png 1884w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>Then we need to script the refresh of our relationship as we alluded to above when describing the &#8220;tickler&#8221; field. We want to trigger this relationship to reevaluate every time the calendar redraws, so we can add just one line to the script &#8220;Activate Webviewer&#8221;:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Script1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-10423\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Script1-1024x939.png\" alt=\"Script1\" width=\"1024\" height=\"939\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script1-1024x939.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script1-300x275.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script1-768x704.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script1-1536x1408.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script1.png 1584w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>And with that we have the totals working as shown in the video at the top of the post. Pretty cool, but definitely more work than it should be. And potentially more error prone and harder to maintain than what follows.<\/p>\n<h2>Using Finds<\/h2>\n<p>The idea behind using finds is that DayBack Calendar is already assembling the records it needs to show on the calendar&#8211;it&#8217;s doing that with a find request. So\u00a0instead of building a parallel method\u00a0of retrieving those records (building relationships), let&#8217;s just get the data right after we&#8217;ve assembled our found set of records to show on the calendar. This\u00a0way, we don&#8217;t need to worry about new filters or additional criteria being added to the calendar down the road: we&#8217;re getting our stats\u00a0<strong>at the same place\u00a0in the code<\/strong> where we get our events.<\/p>\n<p>Here&#8217;s how it works.<\/p>\n<p>We start by creating summary fields for each value we want to sum or count in our events table. This is exactly what you would do if you were making a standard FileMaker report, so you may already have summary fields like these in your table:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-10424\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3-1024x866.png\" alt=\"Fields3\" width=\"1024\" height=\"866\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3-1024x866.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3-300x254.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3-768x650.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3-1536x1300.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields3.png 1884w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>And then we just need a place to put our stats: we won&#8217;t be using calc fields for them anymore, but we still need a place for them to show up on the layout. So create one global field for each of the stats you&#8217;re tracking:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-10435\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1-1024x866.png\" alt=\"Fields4.1\" width=\"1024\" height=\"866\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1-1024x866.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1-300x254.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1-768x650.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1-1536x1300.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Fields4.1.png 1884w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>That&#8217;s it in terms of fields and\u00a0relationships. The rest is done in scripts.<\/p>\n<p>The key to this is to gather our stats at the same place as we gather events, and that means editing the &#8220;Event Find&#8221; script. We&#8217;ll add two lines to clear our totals and then two more\u00a0right after we&#8217;ve checked to make sure events were found. The new lines are highlighted in this screenshot:<\/p>\n<div class=\"lightbox\"><a href=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-10434\" src=\"https:\/\/www.seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1-1024x845.png\" alt=\"Script2.1\" width=\"1024\" height=\"845\" srcset=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1-1024x845.png 1024w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1-300x248.png 300w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1-768x634.png 768w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1-1536x1268.png 1536w, https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/Script2.1-2048x1691.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<p>That&#8217;s almost all there is to it. What you&#8217;ve done so far will work locally and on hosted files. But DayBack uses Perform Script On Server (PSOS) to do its date range finds: that means the globals you set in the script above will be set\u00a0for the <em>server&#8217;s<\/em> session. And they won&#8217;t be accessible to the <em>user&#8217;s<\/em> session. The easiest way around this is to change DayBack&#8217;s settings so it doesn&#8217;t use PSOS. Instructions for doing that are\u00a0here: <a href=\"http:\/\/www.seedcode.com\/pmwiki\/index.php?n=DayBackForFileMaker.PSOS\" target=\"_blank\" rel=\"noopener\">turning off PSOS<\/a>.<\/p>\n<p>(If you want to keep using PSOS, you&#8217;d need to add the stats\u00a0to the script result for &#8220;Event Find&#8221; and that&#8217;s a bit complicated. But it is something SeedCode can do for you as part of an <a href=\"http:\/\/www.seedcode.com\/implementation-packages\/\" target=\"_blank\" rel=\"noopener\">implementation package<\/a>. By the way, making a change like this to an existing script result payload is exactly the kind of thing that native JSON support will make easier: it will be easier to add new objects to an existing payload without breaking the parsing of what&#8217;s already there.)<\/p>\n<p>That&#8217;s it!<\/p>\n<p>Notice that in the script above we gather our stats after the last perform find. That means any new filters you add, any hard-coded filters, and any ad-hoc find requests you make have already happened. We&#8217;re already in the found set that will be rendered on the calendar. This is the perfect place to sum the case value or count the events. Moreover, if you want to go further and say that, for instance, you only wanted the cash value of weekday events, or of events that were unpaid, you could perform additional finds at this point to constrain the found set as we&#8217;ve already recorded the information DayBack needs\u00a0in line 83. Pretty cool.<\/p>\n<h2>Conclusions and Caveats<\/h2>\n<p>I&#8217;d encourage you to add stats like this to your file as it&#8217;s great to see these values change as you balance\u00a0your schedule. Here are some caveats to keep in mind as you go forward.<\/p>\n<h3>Using Relationships<\/h3>\n<ul>\n<li>The biggest issue here is that you have to keep updating relationships and fields as you add new filters to DayBack. That means each filter is represented twice and there&#8217;s definitely the\u00a0possibility that you&#8217;ll code one instance slightly different than the other.<\/li>\n<li>Relationships also have trouble with blank values, as we saw with resources in our movie. The answer is to base the resources part of the relationship on a calculated field that adds some literal string like &#8220;blank&#8221; to the resources for every record. And then in the left-hand side of the relationship, include\u00a0the string &#8220;blank&#8221; if $$sc_ResourceList is blank or includes all your resources. That&#8217;s just more work.<\/li>\n<\/ul>\n<h3>Using Finds<\/h3>\n<ul>\n<li>The only real issue here is PSOS: if your find script runs on the server then any global fields set there are &#8220;on&#8221; the server as well. You need to either <a href=\"http:\/\/www.seedcode.com\/pmwiki\/index.php?n=DayBackForFileMaker.PSOS\" target=\"_blank\" rel=\"noopener\">turn PSOS off in DayBack<\/a> or pass your stats back in a script result the same way DayBack passes back the events themselves.<\/li>\n<li>Aside from that, using finds gets your stats &#8220;closer&#8221; to the source of the calendar&#8217;s request for data: that&#8217;s good.<\/li>\n<\/ul>\n<h3>Caveats for Both Methods<\/h3>\n<p>There are a couple issues to keep in mind that are specific to DayBack or to calendars in general:<\/p>\n<ul>\n<li><strong>Status Filters &#8211;\u00a0<\/strong>\u00a0In order to keep things as fast as possible, DayBack\u00a0does not perform new find requests when you apply status filters. So you&#8217;ll see in these example files that the total cash value and item count don&#8217;t change when status filters are applied. So,\u00a0if you&#8217;d like to include status filters in your stats, simply follow our <a href=\"http:\/\/www.seedcode.com\/pmwiki\/index.php?n=DayBackForFileMaker.Filters\" target=\"_blank\" rel=\"noopener\">instructions\u00a0for adding new filters<\/a>, add your own\u00a0filter for status, and the use your own\u00a0status filter instead of ours. DayBack always performs a new find when your own filters change. You can even hide the original status filters <a href=\"http:\/\/www.seedcode.com\/pmwiki\/index.php?n=DayBackForFileMaker.CSS\" target=\"_blank\" rel=\"noopener\">using CSS<\/a>.<\/li>\n<li><strong>Month Views &#8211;<\/strong>\u00a0Gathering stats for a month is a little different as the found set DayBack builds to draw\u00a0a month view always includes a few days from the previous or the following month. If you look at a month view for December\u00a02016, for example, the first week includes Monday the 28th of November. So the thing to remember is that the techniques described here gather stats for the <em>dates shown<\/em> which will often be more than a discrete month. An easy way around this, if you&#8217;re using the Finds method, is to include a constrain find right before you set your stats field to narrow the request down to just the month you&#8217;re looking for. Week and Day views don&#8217;t have this problem.<\/li>\n<\/ul>\n<p>Hope you&#8217;ve found this useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Customers often want to track stats about the resources\u00a0they&#8217;re\u00a0scheduling in DayBack. They want to answer questions like&#8230; &#8220;How many hours do these assignments represent?&#8221; &#8220;What is the total cash value of the\u00a0confirmed bookings this week?&#8221; [ba-box background=&#8221;#98e382&#8243; border=&#8221;#4b9b55&#8243; textcolor=&#8221;#F7F7F7&#8243;] This kind of reporting is now built into DayBack. \u00a0Check out the new Calendar Analytics introduced in July of 2018: measure values across your schedule. [\/ba-box] Stats\u00a0like these\u00a0are easy to add to DayBack and this post describes two different methods for calculating them. Like many developers, I usually\u00a0think of using relationships first when\u00a0deriving\u00a0date-range stats like these. While that works, I&#8217;ll suggest that using find requests is much easier and results in code that requires a lot less maintenance as your requirements change. A description of both approaches follows, along with unlocked example files. In our examples, we&#8217;ll total\u00a0a new field in the events table called &#8220;Cash Value&#8221; and count the number of events in a\u00a0given week. Overview This short video shows what we&#8217;re trying to accomplish and introduces the two different techniques. Step-by-step instructions for each technique follow below in case you&#8217;d like to add this capability to your copy of DayBack. And here are the unlocked example files for each approach&#8230; Reporting in DayBack Calendar.zip<\/p>\n","protected":false},"author":1,"featured_media":10447,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8],"class_list":["post-10414","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-calendar"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Reporting with DayBack Calendar - SeedCode<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Reporting with DayBack Calendar - SeedCode\" \/>\n<meta property=\"og:description\" content=\"Customers often want to track stats about the resources\u00a0they&#8217;re\u00a0scheduling in DayBack. They want to answer questions like&#8230; &#8220;How many hours do these assignments represent?&#8221; &#8220;What is the total cash value of the\u00a0confirmed bookings this week?&#8221; [ba-box background=&#8221;#98e382&#8243; border=&#8221;#4b9b55&#8243; textcolor=&#8221;#F7F7F7&#8243;] This kind of reporting is now built into DayBack. \u00a0Check out the new Calendar Analytics introduced in July of 2018: measure values across your schedule. [\/ba-box] Stats\u00a0like these\u00a0are easy to add to DayBack and this post describes two different methods for calculating them. Like many developers, I usually\u00a0think of using relationships first when\u00a0deriving\u00a0date-range stats like these. While that works, I&#8217;ll suggest that using find requests is much easier and results in code that requires a lot less maintenance as your requirements change. A description of both approaches follows, along with unlocked example files. In our examples, we&#8217;ll total\u00a0a new field in the events table called &#8220;Cash Value&#8221; and count the number of events in a\u00a0given week. Overview This short video shows what we&#8217;re trying to accomplish and introduces the two different techniques. Step-by-step instructions for each technique follow below in case you&#8217;d like to add this capability to your copy of DayBack. And here are the unlocked example files for each approach&#8230; Reporting in DayBack Calendar.zip\" \/>\n<meta property=\"og:url\" content=\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\" \/>\n<meta property=\"og:site_name\" content=\"SeedCode\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/seedcoder\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-27T15:06:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png\" \/>\n\t<meta property=\"og:image:width\" content=\"319\" \/>\n\t<meta property=\"og:image:height\" content=\"325\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"seedcode\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dayback\" \/>\n<meta name=\"twitter:site\" content=\"@dayback\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"seedcode\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\"},\"author\":{\"name\":\"seedcode\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f\"},\"headline\":\"Reporting with DayBack Calendar\",\"datePublished\":\"2017-01-27T15:06:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\"},\"wordCount\":1741,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/seedcode.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png\",\"keywords\":[\"Calendar\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\",\"url\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\",\"name\":\"Reporting with DayBack Calendar - SeedCode\",\"isPartOf\":{\"@id\":\"https:\/\/seedcode.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png\",\"datePublished\":\"2017-01-27T15:06:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/seedcode.com\/reporting-dayback-calendar\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage\",\"url\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png\",\"contentUrl\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png\",\"width\":319,\"height\":325},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/seedcode.com\/reporting-dayback-calendar\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/seedcode.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reporting with DayBack Calendar\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/seedcode.com\/#website\",\"url\":\"https:\/\/seedcode.com\/\",\"name\":\"SeedCode\",\"description\":\"Build the Software You&#039;ve Always Wanted\",\"publisher\":{\"@id\":\"https:\/\/seedcode.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/seedcode.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/seedcode.com\/#organization\",\"name\":\"SeedCode\",\"url\":\"https:\/\/seedcode.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png\",\"contentUrl\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png\",\"width\":595,\"height\":189,\"caption\":\"SeedCode\"},\"image\":{\"@id\":\"https:\/\/seedcode.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/seedcoder\",\"https:\/\/x.com\/dayback\",\"https:\/\/www.linkedin.com\/company\/seedcode\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f\",\"name\":\"seedcode\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g\",\"caption\":\"seedcode\"},\"sameAs\":[\"https:\/\/seedcode.com\"],\"url\":\"https:\/\/seedcode.com\/author\/seedcode\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Reporting with DayBack Calendar - SeedCode","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/seedcode.com\/reporting-dayback-calendar\/","og_locale":"en_US","og_type":"article","og_title":"Reporting with DayBack Calendar - SeedCode","og_description":"Customers often want to track stats about the resources\u00a0they&#8217;re\u00a0scheduling in DayBack. They want to answer questions like&#8230; &#8220;How many hours do these assignments represent?&#8221; &#8220;What is the total cash value of the\u00a0confirmed bookings this week?&#8221; [ba-box background=&#8221;#98e382&#8243; border=&#8221;#4b9b55&#8243; textcolor=&#8221;#F7F7F7&#8243;] This kind of reporting is now built into DayBack. \u00a0Check out the new Calendar Analytics introduced in July of 2018: measure values across your schedule. [\/ba-box] Stats\u00a0like these\u00a0are easy to add to DayBack and this post describes two different methods for calculating them. Like many developers, I usually\u00a0think of using relationships first when\u00a0deriving\u00a0date-range stats like these. While that works, I&#8217;ll suggest that using find requests is much easier and results in code that requires a lot less maintenance as your requirements change. A description of both approaches follows, along with unlocked example files. In our examples, we&#8217;ll total\u00a0a new field in the events table called &#8220;Cash Value&#8221; and count the number of events in a\u00a0given week. Overview This short video shows what we&#8217;re trying to accomplish and introduces the two different techniques. Step-by-step instructions for each technique follow below in case you&#8217;d like to add this capability to your copy of DayBack. And here are the unlocked example files for each approach&#8230; Reporting in DayBack Calendar.zip","og_url":"https:\/\/seedcode.com\/reporting-dayback-calendar\/","og_site_name":"SeedCode","article_publisher":"https:\/\/www.facebook.com\/seedcoder","article_published_time":"2017-01-27T15:06:37+00:00","og_image":[{"width":319,"height":325,"url":"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png","type":"image\/png"}],"author":"seedcode","twitter_card":"summary_large_image","twitter_creator":"@dayback","twitter_site":"@dayback","twitter_misc":{"Written by":"seedcode","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#article","isPartOf":{"@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/"},"author":{"name":"seedcode","@id":"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f"},"headline":"Reporting with DayBack Calendar","datePublished":"2017-01-27T15:06:37+00:00","mainEntityOfPage":{"@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/"},"wordCount":1741,"commentCount":1,"publisher":{"@id":"https:\/\/seedcode.com\/#organization"},"image":{"@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage"},"thumbnailUrl":"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png","keywords":["Calendar"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/seedcode.com\/reporting-dayback-calendar\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/","url":"https:\/\/seedcode.com\/reporting-dayback-calendar\/","name":"Reporting with DayBack Calendar - SeedCode","isPartOf":{"@id":"https:\/\/seedcode.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage"},"image":{"@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage"},"thumbnailUrl":"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png","datePublished":"2017-01-27T15:06:37+00:00","breadcrumb":{"@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/seedcode.com\/reporting-dayback-calendar\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#primaryimage","url":"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png","contentUrl":"https:\/\/seedcode.com\/wp-content\/uploads\/2017\/01\/range.png","width":319,"height":325},{"@type":"BreadcrumbList","@id":"https:\/\/seedcode.com\/reporting-dayback-calendar\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/seedcode.com\/"},{"@type":"ListItem","position":2,"name":"Reporting with DayBack Calendar"}]},{"@type":"WebSite","@id":"https:\/\/seedcode.com\/#website","url":"https:\/\/seedcode.com\/","name":"SeedCode","description":"Build the Software You&#039;ve Always Wanted","publisher":{"@id":"https:\/\/seedcode.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/seedcode.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/seedcode.com\/#organization","name":"SeedCode","url":"https:\/\/seedcode.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seedcode.com\/#\/schema\/logo\/image\/","url":"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png","contentUrl":"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png","width":595,"height":189,"caption":"SeedCode"},"image":{"@id":"https:\/\/seedcode.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/seedcoder","https:\/\/x.com\/dayback","https:\/\/www.linkedin.com\/company\/seedcode\/"]},{"@type":"Person","@id":"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f","name":"seedcode","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seedcode.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g","caption":"seedcode"},"sameAs":["https:\/\/seedcode.com"],"url":"https:\/\/seedcode.com\/author\/seedcode\/"}]}},"_links":{"self":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/posts\/10414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/comments?post=10414"}],"version-history":[{"count":0,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/posts\/10414\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/media\/10447"}],"wp:attachment":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/media?parent=10414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/categories?post=10414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/tags?post=10414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}