{"id":1938,"date":"2015-02-27T17:30:13","date_gmt":"2015-02-27T09:30:13","guid":{"rendered":"http:\/\/localhost\/help\/?page_id=1938"},"modified":"2017-12-14T14:33:11","modified_gmt":"2017-12-14T06:33:11","slug":"duration-picker-4-3-2","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/controls\/duration-picker\/duration-picker-4-3-2\/","title":{"rendered":"Duration Picker (4.3.2)"},"content":{"rendered":"<p class=\"left-bar\">This article applies to versions 4.3.2 and earlier of P2 Explorer. For help on the latest version of the duration picker, see <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/controls\/duration-picker\/\">Duration Picker<\/a>.<\/p>\n<p class=\"note\">This article describes how to add a Duration\u00a0Picker control to a page during the page design process. For details on how to use the Duration\u00a0Picker\u00a0during run time, see: <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/using-the-page-controls\/using-time-pickers\/\">Using Time Pickers<\/a>.<\/p>\n\n<h3 class=\"page-subheading\">Overview<\/h3>\n<p class=\"intro-text\">The Duration Picker is used to retrieve data from a selected period.\u00a0This is usually used to provide a time range\u00a0for other controls on the page, typically a line chart.<\/p>\n<p class=\"intro-text\">The following diagram shows a Duration Picker\u00a0control being configured:<\/p>\n<p class=\"intro-text\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig3.png\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3169 size-large\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig3-800x319.png\" alt=\"\" width=\"800\" height=\"319\" \/><\/a><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"130\"><strong>Start Time<\/strong>:<\/td>\n<td>The time that the duration begins, defined as an event that the Duration Picker can both publish or\u00a0subscribe to. E.g. If the Start Time is midnight, the first duration of \"12 hours\" represents the period of time from midnight to midday.<\/td>\n<\/tr>\n<tr>\n<td><strong>End Time<\/strong>:<\/td>\n<td>The time that the duration period finishes. This is defined as an event that the Duration Picker can listen to.<\/td>\n<\/tr>\n<tr>\n<td><strong>Duration:<\/strong><\/td>\n<td>The time range that is selected by the user. \u00a0This is\u00a0defined as an event that the Duration Picker can both publish or\u00a0subscribe to.<\/td>\n<\/tr>\n<tr>\n<td><strong>Default Duration:<\/strong><\/td>\n<td>The duration to display when the page is first loaded. This becomes invalid if a default duration is specified in the Event Defaults.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3 class=\"page-subheading\">Tutorial<\/h3>\n<p class=\"intro-text\">The Duration\u00a0Picker is a useful control that enables users to change the type of data that is returned to other controls on a page.<\/p>\n<p class=\"intro-text\">In this tutorial, we'll look at adding a Duration\u00a0Picker that will change what is displayed on a chart as the user selects different dates.<\/p>\n<p class=\"intro-text\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1.png\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3168 size-full\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1.png\" alt=\"\" width=\"869\" height=\"398\" srcset=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1.png 869w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-150x69.png 150w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-768x352.png 768w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-24x11.png 24w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-36x16.png 36w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-48x22.png 48w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/a><\/p>\n<p class=\"intro-text\">Let's go through this process, step-by-step.<\/p>\n<hr \/>\n<h3 class=\"page-subheading\">Step by Step: Creating a Duration\u00a0Picker that Drives a Line\u00a0Chart<\/h3>\n<p class=\"intro-text\">Before you start, open a new tab in Explorer and click the \u201cCreate a New Page in Studio Mode\u201d thumbnail. Choose the <a title=\"Grid Layout\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/controls\/grid-layout\/\">grid<\/a>\u00a0layout - you can adjust the rows and columns if you like but it's not important for this exercise.<\/p>\n<p class=\"intro-text\">If you have access to the training environment, you can follow the steps exactly as outlined here. Otherwise, you will need to adjust the configuration to suit your data.<\/p>\n<p class=\"intro-text\"><strong>Step 1. Add the Duration Picker to the page<\/strong><\/p>\n<p class=\"intro-text\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerdrag1.png\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3170 size-large\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerdrag1-800x422.png\" alt=\"\" width=\"800\" height=\"422\" \/><\/a><\/p>\n<p class=\"intro-text\">Drag and drop the Duration\u00a0Picker\u00a0control onto a grid cell.<\/p>\n<p class=\"intro-text\">\u00a0<\/p>\n<p class=\"intro-text\"><strong>Step 2.\u00a0\u00a0Configure the Duration Picker<\/strong><\/p>\n<p class=\"intro-text\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1.png\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3171 size-full\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1.png\" alt=\"\" width=\"722\" height=\"257\" srcset=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1.png 722w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1-150x53.png 150w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1-24x9.png 24w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1-36x13.png 36w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerconfig1-48x17.png 48w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/a><\/p>\n<p class=\"intro-text\">By default, the Duration\u00a0Picker uses events to configure all its options. In fact, you'll notice that the\u00a0events all come preconfigured with event names. This is because these events are so often used, and by other controls on the page, that it's often unnecessary to bother changing the names. It's best to leave the names as is, but you can change them if you want. If you do change them, you'll need to remember this for the next steps.<\/p>\n<p class=\"intro-text\">\u00a0<\/p>\n<p class=\"intro-text\">\u00a0<strong>\u00a0Step 3.\u00a0\u00a0Create the events<\/strong><\/p>\n<p class=\"intro-text\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3.png\" rel=\"lightbox-4\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3172 size-full\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3.png\" alt=\"\" width=\"723\" height=\"413\" srcset=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3.png 723w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3-150x86.png 150w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3-24x14.png 24w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3-36x21.png 36w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerevents3-48x27.png 48w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><\/a><\/p>\n<p class=\"intro-text\">This step provides the hooks for the Duration\u00a0Picker to send and receive signals (<a title=\"Events\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/events\/\">events<\/a>) to and from other controls on the page.<\/p>\n<ul class=\"intro-text\">\n<li>Click the <em><strong>Event Defaults<\/strong><\/em> button on the far right side of the Studio toolbar.<\/li>\n<li>Create\u00a0an event called <em>\"startTime\"<\/em>\u00a0with a datetime\u00a0set to 4 December 2012 12:00:00 AM.<\/li>\n<li>Create an event called <em>\"endTime\"<\/em> with a datetime set to 5 December 2012 12:00:00 AM.<\/li>\n<li>Create an event called <em>\"duration\"<\/em> with a text value\u00a0set to 24 hours.<\/li>\n<\/ul>\n<p class=\"intro-text\">You can create an\u00a0event at any time. In creating these events, we make them available not only to the Duration Picker, but also to any other controls we may want to place on the page.<\/p>\n<p class=\"intro-text\">Click the preview\u00a0<a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/03\/preview.png\" rel=\"lightbox[1419] lightbox-5\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2896\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/03\/preview.png\" alt=\"preview\" width=\"13\" height=\"14\" \/><\/a>\u00a0button on the Studio toolbar to see what your page will look like in run-time. Observe that the Duration Picker displays a list of time periods ranging from 12 hours to 2 years.<\/p>\n<p>&nbsp;<\/p>\n<p class=\"intro-text\"><strong>Step 4. Add and Configure Source Data<\/strong><\/p>\n<p><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/datepickerdataset.png\" rel=\"lightbox-6\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2190 size-large\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/datepickerdataset-751x600.png\" alt=\"datepickerdataset\" width=\"751\" height=\"600\" \/><\/a><\/p>\n<p class=\"intro-text\">Duration Pickers don't normally do anything by themselves - you use them to drive other controls.\u00a0Ultimately, we want the Duration\u00a0Picker to change the returned data depending on what\u00a0date\u00a0the user selects. Click the preview\u00a0<a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/03\/preview.png\" rel=\"lightbox[1419] lightbox-5\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2896\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/03\/preview.png\" alt=\"preview\" width=\"13\" height=\"14\" \/><\/a>\u00a0button again to switch back to edit mode and <a title=\"Add Data\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/add-data\/\">add some data<\/a>\u00a0that we will use to return data to a chart.<\/p>\n<ul class=\"intro-text\">\n<li>Add the <em>ProductionValuesTrend_Perth<\/em>\u00a0<a title=\"Add a Relational Dataset\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/add-data\/add-a-dataset\/\">dataset<\/a>, and configure it as follows:\n<ul class=\"intro-text\">\n<li>typeTemplate: (Text)\u00a0Completion<\/li>\n<li>names: (List)\u00a0BOSSIER 1-1<\/li>\n<li>readingType: (Text)\u00a0Daily<\/li>\n<li>prodStartTime:\u00a0(Event)\u00a0startTime<\/li>\n<li>prodEndTime: (Event) endTime<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p class=\"intro-text\">As you can see, you need a degree of familiarity with the dataset to know what the parameters mean. In this dataset, we have 2 parameters that can listen to events published by the Duration Picker: <strong>prodStartTime<\/strong>\u00a0and <strong>prodEndTime.<\/strong> This is what ultimately causes the chart to change when the user selects different dates.<\/p>\n<p>&nbsp;<\/p>\n<p class=\"intro-text\"><strong>Step 5. Add and configure the chart<\/strong><\/p>\n<p><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerchart1.png\" rel=\"lightbox-8\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3173 size-large\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerchart1-591x600.png\" alt=\"\" width=\"591\" height=\"600\" \/><\/a><\/p>\n<p class=\"intro-text\">Let's add a <a title=\"Charts\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/controls\/charts\/\">chart<\/a>\u00a0that will make use of the Duration Picker. Drag and drop a Chart component onto another cell on the page. Configure a\u00a0<a title=\"Line Chart\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/controls\/charts\/\">line chart<\/a> as follows:<\/p>\n<ul class=\"intro-text\">\n<li>Source Data:\u00a0ProductionValuesTrend_Perth1<\/li>\n<li>For the chart series:\n<ul class=\"intro-text\">\n<li>Type: Line\u00a0series<\/li>\n<li>Y Column: (Text)\u00a0OIL<\/li>\n<li>Name: (Text)\u00a0Oil<\/li>\n<li>Colour: (Text)\u00a0#80C466<\/li>\n<\/ul>\n<\/li>\n<li>For the X Axis:\n<ul class=\"intro-text\">\n<li>Column: (Text)\u00a0PROD_DATE<\/li>\n<li>Data Type: Time<\/li>\n<li>Min: (event) StartTime<\/li>\n<li>Max: (event) EndTime<\/li>\n<li>Ticks: 5<\/li>\n<\/ul>\n<\/li>\n<li>For the Left Y Axis:\n<ul class=\"intro-text\">\n<li>Enable Gridlines: No<\/li>\n<li>Ticks: 3<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p class=\"intro-text\"><strong>Step 6. All done!\u00a0\u00a0<\/strong><\/p>\n<p class=\"intro-text\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1.png\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3168 size-full\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1.png\" alt=\"\" width=\"869\" height=\"398\" srcset=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1.png 869w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-150x69.png 150w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-768x352.png 768w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-24x11.png 24w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-36x16.png 36w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/durationpickerlive1-48x22.png 48w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/a><\/p>\n<p class=\"intro-text\">Great work! You now have a fully functioning Duration Picker\u00a0that drives a line\u00a0chart.<\/p>\n<ul class=\"intro-text\">\n<li>Click the preview\u00a0<a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/03\/preview.png\" rel=\"lightbox[1419] lightbox-5\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2896\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/03\/preview.png\" alt=\"preview\" width=\"13\" height=\"14\" \/><\/a>\u00a0button on the Studio toolbar to see what your page will look like in run-time.<\/li>\n<li>When the Duration Picker\u00a0first loads, the chart displays data for the corresponding default date.<\/li>\n<li>Choose a different duration to see what happens.<\/li>\n<\/ul>\n<p class=\"intro-text\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1348\" src=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/save.png\" alt=\"save\" width=\"48\" height=\"53\" srcset=\"https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/save.png 48w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/save-22x24.png 22w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/save-33x36.png 33w, https:\/\/oihelp.corporate.ifs.com\/help\/wp-content\/uploads\/2015\/02\/save-43x48.png 43w\" sizes=\"auto, (max-width: 48px) 100vw, 48px\" \/>\u00a0Don't forget to <a title=\"Saving Your Page\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-create-your-first-page\/saving-your-page\/\">save your page<\/a>!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Duration Picker is used to retrieve data from a selected period. This is usually used to provide a time range for other controls on the page, typically a line chart.  This article describes how to add a Duration Picker control to a page during the page design process, in versions 4.3.2 and earlier of P2 Explorer. <\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-explorer\/explorer-studio\/controls\/duration-picker\/duration-picker-4-3-2\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":4499,"parent":13130,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[11],"tags":[348],"class_list":["post-1938","page","type-page","status-publish","has-post-thumbnail","hentry","category-tutorial","tag-date-and-time-pickers","Product-ex"],"_links":{"self":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/1938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/comments?post=1938"}],"version-history":[{"count":0,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/1938\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/13130"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media\/4499"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=1938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=1938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=1938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}