Automatic Updating
Controls the automatic updating of a page in a Displayr document. Used for setting updating schedules.
Options
Update period The time unit for regular updates.
Frequency The multiple of the Update period for regular updating.
Start date and time The date and time of the first update in the format dd-mm-yyyy hh:mm or mm-dd-yyyy hh:mm.
US date format Whether the Start date and time is expressed in US format i.e. mm-dd-yyyy hh:mm.
Time zone An optional time zone for the Start date and time, or else default of UTC applies. Format must be Continent/City, e.g. America/Los_Angeles. See Wikipedia for a list of time zones.
Update exported documents Whether exported documents that refer to the data should also be updated regularly.
Properties
This tab contains options for formatting the size of the object, as well as the underlying R code used to create the visualization, and the JavaScript code use to customize the Object Inspector itself (see Object Inspector for more details about these options). Additional options are available by editing the code.
Code
form.setHeading("Automatic Updating");
var period = form.comboBox({name: "formUpdatePeriod", label: "Update period",
alternatives: ["Months", "Weeks", "Days", "Hours", "Minutes", "Seconds"], default_value: "Days", prompt: "The time units for updating"}).getValue();
var defaultFrequency = 1;
if (period == "Seconds")
defaultFrequency = 600;
else if (period == "Minutes")
defaultFrequency = 10;
form.numericUpDown({name: "formFrequency", label: "Frequency", default_value: defaultFrequency,
prompt: "The update frequency in units of the update period", increment: 1, minimum: defaultFrequency, maximum: Number.MAX_SAFE_INTEGER,});
var start = form.textBox({name: "formStart", label: "Start date and time", prompt: "The first update date and time",
required: false, prompt: "Default now, or e.g. 31-12-2018 18:00:00"}).getValue();
if (start != "") {
form.checkBox({label:"US date format", name:"formUSDate", default_value:false, prompt: "Specify update start date as mm-dd-yyyy"});
form.textBox({name: "formTimeZone", label: "Time zone",
required: false, prompt: "Leave blank for UTC or enter e.g. America/New_York"});
}
form.checkBox({name: "formSnapshot", label: "Update exported documents", default_value: false, prompt: "Whether exported documents should be updated"});
library(flipTime)
options <- ifelse(formSnapshot, "snapshot", "wakeup")
if (formStart != "") {
if (formTimeZone == "") formTimeZone <- "UTC"
UpdateAt(formStart, us.format = formUSDate, time.zone = formTimeZone,
units = tolower(formUpdatePeriod), frequency = formFrequency, options = options)
} else
UpdateEvery(formFrequency, units = tolower(formUpdatePeriod), options = options)
options(digits.secs = 6)
automatic.updating <- paste0("Automatic Updating\nLast updated on Displayr's East Coast US Server Time Zone:\n", format(Sys.time(), "%a %b %d %X %Y"))