Publish to Displayr Drive
Jump to navigation
Jump to search
Publish to Displayr Drive. Sets up a data set to automatically publish its data to Displayr Drive each time this documents is published/exported.
The file will be exported as a QDat file, which is fast to load. If you want your data to update periodically then use Anything > Report > Automatic Updating and tick Update exported documents in the Object Inspector.
includeWeb('QScript Utility Functions'); // for UserError
const data_sets = project.report.selectedDataSets();
if (data_sets.length == 0)
throw new UserError('You must select a data set in the Data tree');
for (let ds of data_sets) {
const already_publishing = !!ds.publishToDisplayrDriveFileName;
const current_index = already_publishing ? 0 : 1;
const new_index = selectOne("Publish data set "+ds.name+" to Displayr Drive", ["Whenever documents is published", "Never"], null, current_index)
if (new_index == 1) {
ds.publishToDisplayrDriveFileName = null;
} else {
let default_file_name;
if (already_publishing)
default_file_name = ds.publishToDisplayrDriveFileName;
else
default_file_name = ds.name.replace(/\..{0,4}/, '.QDat');
ds.publishToDisplayrDriveFileName = prompt('Displayr Drive file name:', default_file_name);
}
}