Default Values (4.5.0)

This article applies to versions 4.5.0-4.5.3 of P2 Explorer. For the latest, see Default Values.

Overview

Default values set the context of a page when it is opened in Display Mode, by supplying the initial values to the page's variables.

For example, a Combo Box should have a default value assigned to its Selected Option variable, otherwise there is no selection when the page opens, and the user has to select something.

Defaults values also set the times (start time and end time) that are used on your page by various components. You can use the standard default value variables, or update these (see Page Times).

Examples of components without a default value:

Examples of those components with a default value:

Default values are also used for dataset parameter variables, to ensure that queries run with useful values as soon as a page is opened. Example: On page open, a query runs where 'Oil' is the default value for the selectedProduct variable, which is used as a parameter for the dataset query.

Some default values, Page Default Values, come standard with all pages; others need to be added, as required.

Related: Read about variables and how these change in Display Mode, through the use of interoperative controls.

Trend Default Values

Trends also have default values, but these have been predefined and cannot be changed when you save a new, blank trend. If you open a trend through a URL or using one of the links from a page (using hyperlink, hotspot, status tiles or charts), you can override the default values. For more information on trend default values, refer to the Variable Parameters section of Link to Trend via a URL.

Overriding Default Values

If you open a page or trend from another Explorer page using hyperlinks, hotspots, status tiles, or charts that have an X Axis Link Action, you can pass values from the calling page, using Variable Mapping. If a default variable is mapped in this way, its value is overridden.

For example, if you have page with a default period of November 2013, you can open the same page via a hyperlink, assigning that page's selected period, May 2015.

Read more about Variable Mapping as a way of passing values to a page or trend as it opens.

Defaults with Relative Values

Some defaults, such as startTime and endTime, have values that vary relative to the current time when you open the page, for example an endTime of 'yesterday', or a startTime that is always five days before the endTime. These settings, and others, are described in the Page Times section below.

Page Default Values

When you add a new page, several page defaults (with a Variable Name, Default Value, and sometimes Data Type) are inserted in the Default Values panel. These cannot be removed.

Variable Name

Default Value

Data Type

endTime the start (12:00 AM) of the day after you create the page Fixed Datetime
startTime the start (12:00 AM) of the day you create the page Fixed Datetime
confidenceThreshhold 80  
pageSampleMethod Average  
pageSampleInterval 3600  
selectedEntity -  

Note that selectedEntity does not come with a default value.

The page default values (with the exception of the selectedEntity default) start out the same for all pages, bringing a measure of uniformity across the various pages. Note that if you change a default value for any of the page variables, you lose this consistency across pages.

The page defaults are used by many of the components. When you add a new component to the page, many of its properties have page defaults already assigned to them.

For example, when you drop an attribute onto the page, this uses a data label component, whose Sample Method, Sample Interval and Time properties use the page default variables of pageSampleMethod, pageSampleInterval and endTime, respectively.

Similarly, when you configure a chart to use tag data, the page defaults pageSampleMethod, pageSampleInterval, startTime and endTime are applied.

Example 1: Sample Method, Sample Interval and End Time for a data label's attribute. Example 2: Sample Method, Sample Interval, Start Time and End Time for a chart's tag data.  

 

Page Times: startTime and endTime

Setting the start time and end time defaults for your page determines the data collection periods, when the page is opened, and also how date time controls will operate.

The endTime page default is applied to the End Time of any time series data added to the page. You can also use this variable for a dataset query parameter of type Datetime.

Similarly, startTime is applied to the Start Time (where there is a time range) of any time series data added to the page, or for dataset query parameters.

The date/time components are preconfigured to use endTime and startTime (where applicable).

Example: The Date Time Range Picker uses startTime and endTime from the page defaults.

The Date/Time Range Picker is preconfigured to use the startTime and endTime page defaults. The page defaults for startTime and endTime, as they appear for a new page. In Display Mode, the Date/Time Range Picker shows the startTime (From) and the endTime (To).

There are various ways to set the start and end date and time:

Automatic Page Refresh

Your page can be configured to refresh automatically. The page refresh interval can be anything from one minute to 12 hours, depending on the configuration in Design Mode.

To set an automatic refresh for the page, click Defaults on the Studio ribbon tab to open the Default Values panel. Select an endTime of Current Datetime, then select a Refresh interval from the drop-down list.

 

Start Time Relative to the End Time

A page can be configured to have a set interval between its start time (startTime) and end time (endTime), for example 24 hours, or one week; this is useful if you want to view a seven days report, for example. Every time the endTime page variable updates (whether through an interoperating control such as a Date/Time Picker, or when the page refreshes), the startTime updates to maintain the relative date time interval.

To set startTime relative to endTime, click Defaults on the Studio ribbon tab to open the Default Values panel. Select a startTime of Relative Datetime, then capture minutes in the Minutes before endTime edit box.

Start Time or End Time as Text

You can also set the start time and end time as Text times. These could be relative to the current date and time (for example, ‘Yesterday’), or they could be fixed date times, for example ‘start of 2016’.

To set an end time as text, click Defaults on the Studio ribbon tab to open the Default Values panel. Select an endTime of Text, then type in a date string, such as ‘yesterday’, ‘last week’ (a week ago), ‘next month’ (a month from now).

Setting an endTime relative to the current time:

The same applies for setting a start time to text. Select a startTime of Text, then type in a date string, such as ‘yesterday’, ‘last week’ (a week ago), ‘end of 2017’.

Setting a startTime relative to the current time:

Fixed Start Time and End Time

When you create a new page, the default for startTime is 12:00:00 AM of the current date, and the default for endTime is 24 hours later.

Both of them are Fixed Datetime, which means that this is always the start time and end time every time the page is reloaded.

To change the endTime, select a new date and time from the DateTime Picker. You can update the startTime in the same way.

Changing the Fixed Datetime for endTime:

confidenceThreshold

This is typically used as the Confidence Threshold variable for meters that have a confidence threshold, such as the Gauge, the Pressure Meter, the Temperature Meter, and the Level Meter.

Example: Here the measured data's confidence, which is returned with the data, is lower than the gauge's defined confidence threshold, so the data indicator shows the Low Confidence symbol.

Note: Data confidence threshold is measured as a percentage, so it must be a value between 1 and 100.

pageSampleMethod

This is applied to the Sample Method of any time series data added to the page. This is the method (for example, average) that P2 Server uses to collect the data. You can select any of these from the drop-down list:

  • Raw
  • Average
  • LinearInterpolate
  • LastKnownValue

pageSampleInterval

This is applied to the Sample Interval of any time series data added to the page. This is the interval (for example, 1 week) that P2 Server uses to collect the trend data. The values here are measured in seconds.

For a new page, this is set to 3600. You can update this by typing in a new number. For example: 21600.

These are the values you can use (express in seconds):

Seconds Corresponds to this Sample Interval
1 1 second
10 10 seconds
30 30 seconds
60 1 minute
300 5 minutes
600 10 minutes
1800 30 minutes
3600 1 hour
21600 6 hours
43200 12 hours
86400 1 day
604800 1 week
1209600 2 weeks
2419200 4 weeks

selectedEntity

The Default Value is not supplied with the selectedEntity variable here. The first time you drag an attribute or attribute value onto the page, the entity for that attribute is inserted here as the default value. Alternatively, you can type an entity name in here.

TOP TIP

When adding an attribute value to a page, press Ctrl then Click and Drag the attribute value onto the page or component property. This assigns the selectedEntity variable, rather than the currently selected entity on the hierarchy navigator.

Using the selectedEntity variable ensures your page can change context, for example if it's a page that you open from the Table of Contents ribbon tab.

 

 

Demo - Setting the variable for the selectedEntity value

1. The default value for a new Explorer page is undefined.

2. Click and drag an attribute from a selected entity (TWell 1), and drag it onto the page.

3. The selectedEntity value is assigned the value of this first entity used on the page: TWell 1.

 

Note: Check where the defaults are already being used, before editing or deleting them.

Adding a Default Value

This section explains how to set up a default value in two steps. For more detailed instructions, jump to the Tutorial.

Open Default Values

The default value panel lists all of the defaults for a page. You can add, remove or change these here.

Click the Defaults button on the Configuration tab group of the Studio ribbon, to open the Default Values panel. To close the Defaults Panel click any button on the Configuration tab group.

What to Add

Find out what variables you have on the page, or plan which variables you are going to use for components on the page, and then assign each of these a default value. You need to match the variable name and data type (for example, Text), and the associated value should come from a set of options for that variable (for example, choose 'Jan' for variable selectedMonth).

Type in the variable name, select a type, and then type in the default value.

Naming Your Default

You can either name your new default to match a variable already used in a component, or you can give it a completely new name.

For example, the combo box component has the variable selectedOption set for its Selected Option property. You can add a new default called selectedOption, matching this, to give the component its initial value. Alternatively (and especially if you are using more than one combo box on your page), you can give the default a new name (such as selectedCurrency, and then update the combo box to use that for its Selected Option.)

Selecting the new default for the component:

Examples of Added Default Values

Here, we have added default values for the respective Selected Option property of three different Option Link components.

This is what the Option Links components look like in Design Mode.

See how this is configured, in the Tutorial.

Note how the selection option value in each case matches one of the items from the Option Values for the component.


Tutorial: Adding Default Values and Option Links

In this tutorial, we're going to add an Option Links component, and then set a Default Value (list) for its Option Values, as well as a Default Value (text) for its Selected Option.

Note: Before you start the tutorial, prepare a page in Studio.

Step 1. Add Default Values

Open the Default Values panel.

1. Click the Defaults button on the Configuration tab group of the Studio ribbon, to open the Default Values panel.

Add a new default value: We're going to add a list of yearly quarters: First, Second, Third and Fourth and call this default Quarters.

2. On the Default Values panel, click the Add button below the Page Defaults.

A new default is added.

3. Type Quarters in the Variable Name edit box.

4. Select List from the Data Type drop-down list.

5. Add the following values into the Default Value text box, clicking Add or pressing the Enter key after each addition: First, Second, Third, Fourth.

Add the next default: Now we're going to add a text value for the selected quarter: Third, and call this default selectedQuarter. This will be the Selected Option for the Option Links component.

6. Click Add.

A new default is added.

7. Type selectedQuarter in the Variable Name edit box.

8. Keep the Text selection in the Data Type drop-down list.

9. Type Third into the Default Value text box.

Step 2. Add and Configure Option Links

Related: See how to add and configure Option Links.

1. Drag an Option Links component onto a grid cell.

2. Click the Option Values edit box to open its data selector.

3. Click the Variables button in the data selector.

4. Select Quarters from the drop-down list.

Note: Because the Quarters variable is defined as a List data type, this is a suitable value for Option Values.

5. Click the Selection Option drop-down list and select selectedQuarter from the drop-down list.

Note: Because selectedQuarter variable is defined as a Text data type, this is a suitable value for Selected Option.

The Option Links now has two defaults:

This is how your Option Links should look in Studio. You've set this up entirely using default values.

 


Variable Types

The table below contains the different variable types you can use for default variables.

Data Type Examples of Usage
Attribute The Attribute for a Data Label component's Value (if it is using attribute data).
AttributeValue The Attribute Value for a Data Label component's Value (if it is using attribute data).
Calculation The Calculation for a Data Label component's Value (if it is using ad hoc calculation data).
CalculationList The Calculations for a Data Table component's Data (if it is using ad hoc calculation data).
Datetime The Date/Time of a Current Date/Time Toggle component.
Entity The Selected Entity of a Hierarchy component; the Entity for a Data Label component's Value (if it is using attribute data).
EntityList The Selected Entities of a Hierarchy component (using Multiple Select Mode); the Entities of a Data Table component's Data (if it is using attribute data).
List The Option Values or Option Names for a Combo Box or Option Links component.
Number The default selection (Selected Option) for a Combo Box component; the Value for a Data Label component's Value (if it is using value data).
Tag The Tag for a Data Label component's Value (if it is using tag data); the Tag for a Level Meter component's Upper Limit (if it is using tag data).
TagList The Tags for a Data Table's Data component (if it is using Tag data).
Template The Template for a Data Label component's Value (if it is using atyour page can change context, for example if it's tribute data).
Text The Selected Option for a Combo Box component; part of the Content for a Text Label component.
Yes/No The Hide Config Panel of a Pivot Table component.

Release History

  • Default Values 4.5 (this release):
    • Defaults are logically grouped
    • Standard page variables no longer editable
    • Changes to startTime and endTime variables
  • Default Values 4.4.2
    • Introduced Calculation and CalculationList as new data types that can be assigned to default values.

 

Comments are closed