\define create_id_from_timedata(prefix) $prefix$-<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>>
\define uniqueId(prefix:id)
<$wikify name=id text=<<create_id_from_timedata """$prefix$""">> >
<$button class="tc-btn-invisible" message="tm-copy-to-clipboard" param=<<id>> >
{{$:/core/images/copy-clipboard}} create unique id
</$button>
</$wikify>
\endRefereeing to recent discussion on The Good and Bad of qualify: https://groups.google.com/d/msg/tiddlywiki/51XMzmLGxfQ/PLkfWWthBAAJWe know many cases in creating User Interfaces (UI) needs some state tiddlers.
I got used to call qualify for such cases, but with the recent discussion it seems qualify is designed for purposes one like to keep some states permanently and irrespective of current tiddler situation.
Refereeing to recent discussion on The Good and Bad of qualify: https://groups.google.com/d/msg/tiddlywiki/51XMzmLGxfQ/PLkfWWthBAAJWe know many cases in creating User Interfaces (UI) needs some state tiddlers.
I got used to call qualify for such cases, but with the recent discussion it seems qualify is designed for purposes one like to keep some states permanently and irrespective of current tiddler situation.
My question is:Is there any other ways to create unique stateTiddler? I dont mean do this manually?
There are situation, one needs permanent state tiddler to keep data. For example in Shiraz dynamic table I uses state tiddler to keep footer data or row styles.These are not temporary data and it is tedious to define unique state tiddler for every table!
The current mechanism I use is qualify macro which is not good for all scenario.
p.s:One KISS solution is to use a helper function which calls now macro with [UTC]YYYY0MM0DD0hh0mm0ssXXX format to create a unique title for the required state tiddler.
On Monday, February 10, 2020 at 1:14:40 PM UTC+1, Mohammad wrote:Refereeing to recent discussion on The Good and Bad of qualify: https://groups.google.com/d/msg/tiddlywiki/51XMzmLGxfQ/PLkfWWthBAAJWe know many cases in creating User Interfaces (UI) needs some state tiddlers.I got used to call qualify for such cases, but with the recent discussion it seems qualify is designed for purposes one like to keep some states permanently and irrespective of current tiddler situation.I know it's not a real solution for your request but anyway:I did create a PR at github, that allows the qualify-macro to use a isUnique parameter. So you can use<<qualify "my-unique-title" isUnique:"yes">> .. So the macro doesn't add -123456 string. It returns the input state text.
My question is:Is there any other ways to create unique stateTiddler? I dont mean do this manually?Sure - but we didn't find it - yet ;)There are situation, one needs permanent state tiddler to keep data. For example in Shiraz dynamic table I uses state tiddler to keep footer data or row styles.These are not temporary data and it is tedious to define unique state tiddler for every table!As I wrote, you need to work with variables like tiddler-names, tab-names, list-items and so on. ... And yes creating "real" uniqueness is hard, if it should be predictable.The current mechanism I use is qualify macro which is not good for all scenario.that's right.p.s:One KISS solution is to use a helper function which calls now macro with [UTC]YYYY0MM0DD0hh0mm0ssXXX format to create a unique title for the required state tiddler.... And you can remember their names, if you have many of them?
-mario
On Monday, February 10, 2020 at 5:12:04 PM UTC+3:30, PMario wrote:
.....
I know it's not a real solution for your request but anyway:I did create a PR at github, that allows the qualify-macro to use a isUnique parameter. So you can use<<qualify "my-unique-title" isUnique:"yes">> .. So the macro doesn't add -123456 string. It returns the input state text.Are these unique permanent state or will be changed from session to another session or different position of host tiddler in the widget tree?
My use case is to put some table properties created interactively by user when Shiraz dynamic table is used. Each table uses a state tiddler like $:/keepstate/dtable/xxx/xxxx/???so, one time is created I do not need to explicitly refer to it!I cannot use variable or fields here, as I do not know how many tables a user created per tiddler.
On Monday, February 10, 2020 at 3:07:06 PM UTC+1, Mohammad wrote:
On Monday, February 10, 2020 at 5:12:04 PM UTC+3:30, PMario wrote:
.....I know it's not a real solution for your request but anyway:I did create a PR at github, that allows the qualify-macro to use a isUnique parameter. So you can use<<qualify "my-unique-title" isUnique:"yes">> .. So the macro doesn't add -123456 string. It returns the input state text.Are these unique permanent state or will be changed from session to another session or different position of host tiddler in the widget tree?It basically is a "title-pass-through". So the user has to make the title unique. ... The advantage is, that there is a new parameter isUniqueEg: the core tabs macro uses the <<qualify "$state$">> in the macro code. .. The problem now is, that as a developer I need to change the core tabs macro if I don't want the default behaviour of the qualify macro. ...If you have a look at the PR, I also changed the core tabs macro like so: <<qualify "$state$" "$isUnique$">> .. and the tabs macro gets a new parameter isUnique too. .. So no need to change the core tabs macro anymore, just to give it a state with a different behaviour......My use case is to put some table properties created interactively by user when Shiraz dynamic table is used. Each table uses a state tiddler like $:/keepstate/dtable/xxx/xxxx/???so, one time is created I do not need to explicitly refer to it!I cannot use variable or fields here, as I do not know how many tables a user created per tiddler.Can you provide a link to some of your state creation tiddler and some code that uses those macros? .. I have no idea what Shiraz tables do and how they are created.
The qualify macro code has a "hidden feature" that isn't exposed to wiki users. ... It creates the unique hash based on the "transclusion" variable in the widget tree. ... transclusion is the default variable name defined by the code.This variable name could be assigned by users, but the qualify macro doesn't use this name atm. .. I did experiment, if it could be used to create predictable unique states. ... BUT the mechanism only creates headaches.-m
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a6ded49c-677e-4e38-85ac-985a4216a0e8%40googlegroups.com.
On Monday, February 10, 2020 at 3:07:06 PM UTC+1, Mohammad wrote:
On Monday, February 10, 2020 at 5:12:04 PM UTC+3:30, PMario wrote:
.....I know it's not a real solution for your request but anyway:I did create a PR at github, that allows the qualify-macro to use a isUnique parameter. So you can use<<qualify "my-unique-title" isUnique:"yes">> .. So the macro doesn't add -123456 string. It returns the input state text.Are these unique permanent state or will be changed from session to another session or different position of host tiddler in the widget tree?It basically is a "title-pass-through". So the user has to make the title unique. ... The advantage is, that there is a new parameter isUniqueEg: the core tabs macro uses the <<qualify "$state$">> in the macro code. .. The problem now is, that as a developer I need to change the core tabs macro if I don't want the default behaviour of the qualify macro. ...If you have a look at the PR, I also changed the core tabs macro like so: <<qualify "$state$" "$isUnique$">> .. and the tabs macro gets a new parameter isUnique too. .. So no need to change the core tabs macro anymore, just to give it a state with a different behaviour......My use case is to put some table properties created interactively by user when Shiraz dynamic table is used. Each table uses a state tiddler like $:/keepstate/dtable/xxx/xxxx/???so, one time is created I do not need to explicitly refer to it!I cannot use variable or fields here, as I do not know how many tables a user created per tiddler.Can you provide a link to some of your state creation tiddler and some code that uses those macros? .. I have no idea what Shiraz tables do and how they are created.
Mohammad,Personally I feel we have all the possibilities available to use already.
- However I must ask where are you wanting to use state tiddlers?
I ask because arguably they usually relate to an open tiddler, but then if you want to toggle states one or more transclusions deep or in a macro unless you make use of the currentTiddler/storyTiddler something else is needed.
I will push a new update but at the moment you can find these macros hereA table is created using table-fd macro. Then the use in UI wants to add numerical summary like average of midterm score.These summaries are stored in a state tiddler like keepstate defined like below\define keepstate() $:/keepstate/dynamictables/$(currentTiddler)$/$(stateTiddler)$and currentTable is a variable defined ascurrentTable=<<qualify $stateTiddler$>>Two issues here- if in another session qualify generate another cryptic string, then table will lose its connection to its state- if one rename the host tiddler the connection to state tiddler breaks again! BUT thanks to relink plugin, if it installed this issue has gone!- if the host tiddler (the one has a dynamic table) is transcluded through tabs, scripts, ... again the currentTable variable will change (a consequence of qualify macro behavior) again table will lose its stateTiddler (this case is partially addressed in Shiraz)I thought the kind of stateTiddler required in cases like dynamic tables is of permanent type! if they removed (like $:/state and $:/temp) whena session is terminated or their title changed because of qualify working mechanism
I'll need to have a closer look, but I don't have the time atm.
-mario