Discussion:
[tw] How to get a record index of a named property from a data tiddler?
(too old to reply)
oleghbond
2018-02-07 09:18:26 UTC
Permalink
Raw Message
Dear All,

I've encountered an issue which I need to resolve, namely: How to get a
record index of a named property from a data tiddler?

Say, I've got the following set of records in a data tiddler:

*{"oct":31,"nov":30,"dec":31}*


As one can see the number index value of the named property, say, *"nov"* is
2.

But how can I get this number index using a macros of a plugin?

I feel that it should be somehow simply, but I've no idea how.

I would be grateful for your help.

Olegh
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/623ce7a2-4cfe-4dfa-b406-516fe2dea579%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BurningTreeC
2018-02-07 11:21:47 UTC
Permalink
Raw Message
Hi @oleghbond,

say your data tiddler is called "datatiddler":

<$list filter="[[datatiddler]getindex[nov]]"> <<currentTiddler>> </$list>

gives you "30" as result

you can do it in different ways. look
at https://tiddlywiki.com/#getindex%20Operator

BurningTreeC
Post by oleghbond
Dear All,
I've encountered an issue which I need to resolve, namely: How to get a
record index of a named property from a data tiddler?
*{"oct":31,"nov":30,"dec":31}*
As one can see the number index value of the named property, say, *"nov"* is
2.
But how can I get this number index using a macros of a plugin?
I feel that it should be somehow simply, but I've no idea how.
I would be grateful for your help.
Olegh
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/68ce1ef5-18eb-4b9c-a155-9f92c82be91a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
oleghbond
2018-02-07 17:09:30 UTC
Permalink
Raw Message
Thank you very much,

I would like to clarify a bit the misinterpreting of my request.

What you suggest returns the value of the array under char index "nov",
which is - 30. Whereas I looked for a method for returning the number index
of the char index "nov", which is - 2, just because it is the second
element of the array.

Any idea?
Post by BurningTreeC
<$list filter="[[datatiddler]getindex[nov]]"> <<currentTiddler>> </$list>
gives you "30" as result
you can do it in different ways. look at
https://tiddlywiki.com/#getindex%20Operator
BurningTreeC
Post by oleghbond
Dear All,
I've encountered an issue which I need to resolve, namely: How to get a
record index of a named property from a data tiddler?
*{"oct":31,"nov":30,"dec":31}*
As one can see the number index value of the named property, say,
*"nov"* is 2.
But how can I get this number index using a macros of a plugin?
I feel that it should be somehow simply, but I've no idea how.
I would be grateful for your help.
Olegh
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/81bdfb4c-4f82-40fa-91d1-1a131c058298%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BurningTreeC
2018-02-07 11:22:46 UTC
Permalink
Raw Message
or easy: {{datatiddler##nov}}
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/80f8238d-0fec-4867-aaea-c9e2e55704ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BurningTreeC
2018-02-07 18:15:39 UTC
Permalink
Raw Message
Hi olegh, sorry I got it wrong.

That's more complex...


could this work for you?

<$set name="indexName" value="nov">

<$set name="indexes" filter="[[datatiddler]indexes[]]">
<$set name="length" filter="[enlist<indexes>] +[count[]]">
<$list filter="1 2 3 4 5 6 7 8 9 10 +[limit<length>]" variable="index">

<$list filter="[enlist<indexes>nth<index>regexp<indexName>]">

<<index>>

</$list>
</$list>
</$set>
</$set>

</$set>
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1fa7c0ed-8997-4e20-8a44-ba7765caa33e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BurningTreeC
2018-02-07 18:17:25 UTC
Permalink
Raw Message
instead of the 1 2 3 4 5.... I normally use a tiddler that holds all
integers from 1 to x in its list field and use the filter
[list[integernumberstiddler]limit<length>]] variable="index"
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/817734e3-0158-4055-b579-cc48db854daf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BurningTreeC
2018-02-07 18:20:16 UTC
Permalink
Raw Message
at last I think this would be better:

\define getTheIndex()
<$list filter="[enlist[$(indexes)$]nth[$(index)$]regexp[^$(indexName)$]]">

<<index>>

</$list>
\end


<$set name="indexName" value="nov">

<$set name="indexes" filter="[[datatiddler]indexes[]]">
<$set name="length" filter="[enlist<indexes>] +[count[]]">
<$list filter="1 2 3 4 5 6 7 8 9 10 +[limit<length>]" variable="index">

<<getTheIndex>>

</$list>
</$set>
</$set>

</$set>
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e0de2822-76a8-4dfd-ae6b-7b5caab9f94d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
BurningTreeC
2018-02-07 18:23:45 UTC
Permalink
Raw Message
... and I see I must add a reverse[] to the list: <$list filter="1 2 3 4 5
6 7 8 9 10 +[limit<length>reverse[]]" variable="index">
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1884b144-0dd4-48ff-8a61-df41817128f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2018-02-07 23:22:32 UTC
Permalink
Raw Message
If you're just dealing with the months of the year, then the other easy
possibility is to make a second data tiddler:

*{"oct":1,"nov":2,"dec":3}*


-- Mark
Post by oleghbond
Dear All,
I've encountered an issue which I need to resolve, namely: How to get a
record index of a named property from a data tiddler?
*{"oct":31,"nov":30,"dec":31}*
As one can see the number index value of the named property, say, *"nov"* is
2.
But how can I get this number index using a macros of a plugin?
I feel that it should be somehow simply, but I've no idea how.
I would be grateful for your help.
Olegh
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/9fa7612d-6250-476b-aa65-0228edaa8a78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...