Insides on Bookmarking
As there are some questions on this functionality in Design Studio (Bookmarks) I post here some insides on “how this function is working”. I hope this helps better in understanding what the technical solution is – and based on this some actions and behavior after save / load bookmark will get clearer.
The purpose of bookmarks is to save the visible state of the application for a specific user. In 1.3 release the list of bookmarks is user-specific, but anyone who knows the ID can execute a bookmark of a different user directly in URL (parameter BOOKMARK=<ID>).
I do not want to rewrite the blog “Working with Bookmarks in Design Studio 1.3” as this is already containing information on bookmarks. The goal here is to give some technical background to explain the behavior after loading a bookmark.
Part 1. Saved Content
Currently the bookmarks are saving ALL information about the current application – this is containing in particular:
- Data Source(s) (including name, filters, variables, drilldown, expanded hierarchies)
- all Components which are available in the application – all component properties will be saved as they look like at the time of save
In both cases, you can look at the content of BIBOK file contained in the local repository under “/_TECHNICAL_CONTENT/” subfolder. You will see a flat list of components and data sources with something called “INIT_PARAMETERS” which represent the state of the application on runtime. Those init parameters are corresponding to the properties visible in designer and you will find there your all values.
Part 2. Saved Parameters / Properties
The saved parameters are containing all available properties – this includes also scripts and content of the components (e.g. list of items in a drop down). This should explain why when you save a bookmark and then add it to some drop down in the application – after load of the same bookmark the dropdown is again empty. It was empty at the time of save and this was saved in the bookmark.
Part 3. Load of Bookmarks
Why obsolete bookmarks are not listed?
Technically, it is possible to load also obsolete bookmarks – but, taking into count the facts described in “Part 2”, load of such bookmark would reset all changed done in the application to the point of time as the bookmark was saved. Based on this fact, listing of old bookmarks for the end user is not supported.
Loading of an Obsolete Bookmark
The opening of a bookmark via URL (using the shared URL) is loading the bookmark. There are some defined rules how such bookmarks are applied on the application:
- (1) new components (only positioned on the root container level) in the application are not touched – those will be not affected by loaded bookmark
- eg. you introduce a component “BUTTON_NEW” on the root container level – it will be available even a bookmark is loaded on the application
- components which are introduced as children of some panels will be not visible as the parent container does not know about them
- (2) changed properties of existing component will be overwritten by the loaded content from bookmark
- eg. you change a property TEXT for component “BUTTON_OLD” to “New Text” from “Old Text” – the changed text property will become “Old Text” as this was the value in the bookmark.
- (3) deletion of component in the application affected by bookmark – loaded bookmark will create the components again even those were deleted in the application.
Part 4. What to do after load of bookmark to propagate correctly the bookmark-dropdown?
After loading a bookmark you have to re-create the dropdown by calling explicitly the scripts to get again the actual list of bookmarks and passing the content to the dropdown. Here you will probably face also the issue with selection of first item – this is currently known issue in drop down which has an event “onSelect”, but technically this is an “onChange” event – therefore currently selected index cannot be selected again as it does not change.
Part 5. Global Script Variables & Local Script Variables
Why local script variables are lost in script after loading the bookmark?
Load of the bookmark needs to reset the application. For this reason the script will be interrupted and re-run with next statement after the bookmark is loaded. All local variables are not defined anymore and cannot be used in the sequence of calls after bookmark load.
What happen to global script variables ?
The global script variables are behaving same as the content of any other component – saved in a bookmark and restored by bookmark load to the value which was saved in the bookmark. This means, you cannot use them to pass some values when loading a bookmark.
Part 6. Startup script and bookmarks.
The script “onStartup()” will be NOT executed when loading a standard bookmark. Only the fragment bookmark does execute the scripts when loaded.
Part 7. Ideas on how to handle th bookmarks workflows.
Solution for dropdown issue. Always add first an entry “- select a bookmark – ” to assure that the user can select the “first” entry which is located technically on index 2. (discussed in thread ).
Passing Values between bookmark loads.
If you ask yourself how to pass values which you know before loading a bookmark – and you want to use after you loaded a bookmark. As of today you need to save them as a bookmark as well, but not using the bookmark itself, but playing with the title of the bookmark. E.g. save a bookmark giving it a title starting with “|” character – then you can pass some name=values separating by “;” character. after loading the real bookmark, you can again loop on all available bookmarks and re-parse the title of the one starting with “|” character. of course you have immediately to delete it. I will try to make an example of this soon – it is not the best implementation, but the current possibility.
Example: Passing Values on Bookmark Load by Additional Bookmark.
In the attached application (works on 1.3 release, you have to create a folder in local repository “INSIDE_BOOKMARK” and copy the file “content.biapp.txt” into the fodler, renaming to content.biapp) you can find some code which helps you to pass values on bookmark load. It is not a perfect implementation, as this is saving a temporary bookmark (which costs also performance) and reuses the bookmark title to build up a name=value pairs which need to be parsed after load. This implementation is only (as far I know) one possible way to pass values through bookmark load.
- Load All Bookmarks – simple script to reload actual bookmarks and pass into the dropdown box (with additional entry to overcome the selection problem in dropdown box )
- Personalize Application / Delete Personalization – you can check here what happen when you personalize application and load a bookmark
- Save Bookmark – taking the text as bookmark description
- List Of Bookmarks – dropdown with all available bookmarks, only for choice – no event “onSelect”
- Load Bookmark – Simple case, just load a bookmark
- Load Bookmark – Use the additional workflow to load a bookmark, but keep some actual values as they are now
- the input field is just to see what bookmark has loaded – you can put here any text which will help you to recognize the bookmark content, there is no “magic” on this field, it is loaded as it was in bookmark
- the input field for global script variable (MY_VARIABLE) which can be applied (Apply) and reloaded into the text field (Reload – use this after bookmark is loaded to check actual value). The sctipt variable is then visible in the text with current content “- empty -“
- the input filed for any content which should be kept on bookmark load – when using the “transfer” variant of load.
- REUSABLE_SCRIPTS (an hidden panel with 2 checkboxes)
- the first one is a function which is executed before a bookmark is loaded – it is responsible for collecting the values and save of the temporary bookmark
- the first one is loading the temporary bookmark and reading its title to parse the values and distribute to corresponding areas (global variables or properties of components)
Part 7. Future Direction
Development unit is trying to improve the bookmarking functionality by introduction of an “embedded” bookmarks – which will allow to save only an embedded part of an application. By this handling of the bookmarks will be easier – as the load would not reset completely the application, but would reload only a part of it (e.g. some container). Using that, the saved content can be separated from the scripts and would allow more flexibility in bookmarking.
In case of any questions, please post – I will update the content.