Permanent: Boolean;
The Permanent property indicates if workbook is saved to the repository.
To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and the following code must be added in the document opening event handler:
var messageString;
//Get whether workbook is saved in repository
var permanent = wbk.getPermanent();
//Output information whether workbook is in repository
permanent?(messageString="Workbook si saved in repository"):(messageString="Workbook is not saved in repository");
alert(messageString);
var createWbkFromRubButt = new PP.Ui.Button({
ParentNode: document.body, //DOM parent node
Content: "Create Workbook", //Text
Click: PP.Delegate(onClickCreateWbkFromRub)
});
function onClickCreateWbkFromRub(){
//Get time series database key
var rubKey = wbk.getActiveSheet().getRub().meta.obInst.obDesc.k;
//Create a workbook from factor directory and open it
tsService.createWbkFromRub(rubKey, PP.Delegate(onResponse));
}
function onResponse(sender, args){
//Get the created workbook
var wbk = args.Workbook;
//Set the created workbook as a data source for the workbookBox component
workbookBox.setSource(wbk);
//Get whether workbook is saved in repository
permanent = wbk.getPermanent();
//Output information whether workbook is in repository
permanent?(messageString="Created workbook is saved in repository"):(messageString="Created workbook is not saved in repository")
alert(messageString);
}
After executing the example a New Book button is placed in the page, on loading the page the screen shows a message that the workbook is saved to the repository. Clicking the New Book button creates a new book based on time series database and sets this book as a source for the component that displays workbook. Information that the workbook is not saved in the repository appears in the screen.
See also: