
Introduction
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.
Why bookmarks?
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>).
Technical Background
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:
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:
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 Bookmarks and Selection in Dropdown).
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.
Functions.
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.
Questions?
In case of any questions, please post - I will update the content.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
16 | |
13 | |
11 | |
9 | |
9 | |
8 | |
7 | |
6 | |
6 | |
6 |