[tw5] Re: Count data dictionary values

2019-06-09 Thread Watt
Thanks Mario, thanks Tony - I'll play with everything and become a data tiddler 
ninja.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/fcf0ecdd-9c69-4795-a7b2-6e501cbe1beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-09 Thread PMario
Hi Watt, 

Be aware: The "sum[]" operator will only work with TW version 5.1.20+

Try this.

<$set name="digit-pattern" value="[0][0-9]">
<$list filter="[tag[test-data]keyvalues:key,value:-->sum[]]" 
variable=item>
<>



In the above example, it uses every data tiddler tagged: test-data
 is used to define the range eg: if you use [0][0-2] you'll 
limit it to 00, 01, 02 indices.

Without sum[] it looks like

<$list filter="[tag[xx]keyvalues:key,value:-->:usevalue[1]count[]]" 
variable=item>
<>


I did create a video series, some time ago, where I did explain everything 
step by step. One element of the project is manipulating data-tiddlers. ... 
Because I did have some trouble using it, I did create the PR now. If I 
would have had the new "keyvalues" operator, I think it would have been 
easier. 

There is an edition, you can play with. 

see: TiddlyWiki Script and ToDo manager HowTo

The Intro post is here: 
https://groups.google.com/forum/#!msg/tiddlywiki/_VQw8yIKWn8/G8TO8h6MCAAJ

have fun!
mario

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/9db2b5b5-9efc-49b2-991d-9d57e0c8022e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-09 Thread Watt
Thank you TonyM and PMario for developing this further. It is much appreciated. 
Data tiddlers have always been a mystery to me but I'm beginning to see how 
useful they can be and anything that makes them more accessible is great for 
beginners.
 
The documentation for creating them, appending and editing them and then 
manipulating and extracting their index keys and values can take a bit of 
understanding. Anything that simplifies the process and provides more examples 
and clues is a big help for the uninitiated. If you're typing in a filter on a 
phone keyboard you also really appreciate simplicity.

PMario if you can, could I ask you for an example of how to count the '1's as 
per my original post? 

01: 0
02: 1
03: 1
04: 0
05: 1
06: 0

I've got it working with TonyM's method but not worked it out with your PR 
version. At the moment I'm more interested in manipulating values rather than 
keys so the many examples on your demo page help a lot, but the one example I 
needed wasn't there (always the case when I'm looking for examples!)

Thanks again guys, it's a valuable discussion.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/89c5d2e6-088a-4ded-830e-19926c17b859%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-08 Thread TonyM
Mario,

The problem is, that filter operators have no knowledge about the widget 
> context they are called in. They are designed to have no side effects.


In some ways this handicaps us. This possibly needs to remain the case, 
however we should be able to provide an alternative method.

I believe I have found a way and will open two new threads soon, since this 
is wandering off topic,  best in Development forum I expect?


   - Processing Key Value Pairs
   - Turning key=value, fieldname/value and variables into global variables

Regards
Tony

On Saturday, June 8, 2019 at 10:37:21 PM UTC+10, PMario wrote:
>
> I know what you mean. The problem is, that filter operators have no 
> knowledge about the widget context they are called in. They are designed to 
> have no side effects. 
>
> -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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/29844f22-15bb-441b-aadf-ea4731d004c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-08 Thread PMario
I know what you mean. The problem is, that filter operators have no knowledge 
about the widget context they are called in. They are designed to have no side 
effects. 

-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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/621909d8-b741-47bb-b6d0-6590cdc09c82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-08 Thread TonyM
Mario,

I think I understand what you mean but my observation of this was calling a 
modal with key=value pairs  and at least within the modal the variables are 
populated. This looks like a workaround however the modal needs to define a 
close action and that could write the variables values elsewhere, like tiddlers 
or fields. Or even write a tiddler taged as a macro that defines and sets 
global variables.

In fact writing the content of a global macro may be a way to bypass this 
limitation.

I know this is a somewhat advanced idea and I may not have expressed it well 
but I hope you see what I mean.

Thony 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/1bba5abb-371d-4e32-b8a2-733d9204534d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-08 Thread PMario
Hi. I did have a look at those possibilities but I couldn't find a way that 
filter operators can return internal values to the calling widget. 
-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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/9c579569-adaa-433b-aaf7-4383a887de44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-07 Thread TonyM
Mario

I noticed when using macros or action widgets such as newttiddler parameters of 
the form name=value can be automatically converted to variables containing the 
value. I would like to see a method to do this with multiple key value pairs 
exposed for users. Solutions such as yours would benefit from returning such 
key value pairs that they could be handled like this. Imagin if we could 
iterate a data tiddler and have <> and <> and even <> 
returned. 

We could also have data tiddlers we access primarily by index number. 

Regards
Tony

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/405233f0-68fc-4194-8974-e3a8fa468b68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-07 Thread PMario
Hi, 

BE AWARE: The whole thing is still beta. 5.1.20 isn't released yet. 

I did just create a PR at github: 
https://github.com/Jermolene/TiddlyWiki5/pull/3971
and a test version is uploaded to tiddlyspot: http://3971.tiddlyspot.com

have fun!
mario

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/95635bec-b8e5-47eb-8ddd-63f4949a928e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-04 Thread Watt
Thanks for taking this further PMario! I'm only just getting to grips with data 
tiddlers but they seem to me to be similar to single column spreadsheets. They 
have an index and a single column of values, and each value 'slot' is similar 
to a spreadsheet's cell in just one column. 
If I create 2 or more data tiddlers with the same indexes then the number of 
value columns available to my 'spreadsheet' expands and 'cells' across both 
tiddlers can be referenced by {{distinctdatatiddlername##sharedindex}}.
In an ideal world I'd like to be able to sum those values but also to be able 
to carry out the other maths operations that a spreadsheet allows on individual 
values, ranges of values, groups of values that match a criteria etc - (i.e 
values filtered to meet a condition, across several data tiddlers).
I hope that makes some sort of sense. Just my 2 shrimps worth if you're 
thinking about formulating a pull request.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/4022bf72-b074-4f98-aa7e-4c6c4ca01b6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-04 Thread Watt
Thanks for taking this further PMario! Hope I'm not sounding like Forest Gump 
here but data tiddlers seem to me to be similar to single column spreadsheets. 
They have an index and a single column of values, and each value 'slot' is 
similar to a spreadsheet's cell in just one column. 
If I create 2 or more data tiddlers with the same indexes then the number of 
value columns available to my 'spreadsheet' expands and 'cells' across both 
tiddlers can be referenced by {{distinctdatatiddlername##sharedindex}}.
In an ideal world I'd like to be able to sum those values but also to be able 
to carry out the other maths operations that a spreadsheet allows on individual 
values, ranges of values, groups of values that match a criteria etc - (i.e 
values filtered to meet a condition, across several data tiddlers).
I hope that makes some sort of sense. Just my 2 shrimps worth if you're 
thinking about formulating a pull request.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/46fd177a-c43d-471f-8641-f4ebdc399448%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-04 Thread PMario

On Tuesday, June 4, 2019 at 10:22:55 AM UTC+2, PMario wrote:
>
> On Tuesday, June 4, 2019 at 8:56:02 AM UTC+2, TonyM wrote:
>>
>>
>> Do you think we could also provide values with other inputs like 
>> values values{!!fieldname} values{tiddlername!!fieldname}  if it 
>> could parse this with spaces as the delimiter then numeric lists in a 
>> variable will not be deduped and can feed into our maths operators.
>>
>
> I think this is the existing "enlist" operator.
>

uups ... missed the "deduped" :)
-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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/4b726e0b-4f48-40c5-ace0-b8771d0d3894%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-04 Thread PMario
On Tuesday, June 4, 2019 at 8:57:28 AM UTC+2, TonyM wrote:
>
> values[1 2 1 2 3]sum[]
>

same as indexes. ... no parameters

-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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/4de116fd-2583-4dce-8a00-333665d4b8b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-04 Thread PMario
Hi,

Working with data-tiddlers there is the "indexes" and the "getindex" 
operators. ... BUT they are not enough with the new math functions. 

As the OP shows. ... The new "values" operator works similar to the 
"indexes" operator, but it lists the values instead of the indexes (keys)

Since the both outputs are sorted, I also want to have an "keyvalues" 
operator, which will allow us to get both elements, and use string 
manipulation afterwards. 

-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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/470da3e5-7e32-49c0-af9a-bc182120dc8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-04 Thread PMario
On Tuesday, June 4, 2019 at 8:56:02 AM UTC+2, TonyM wrote:
>
>
> Do you think we could also provide values with other inputs like 
> values values{!!fieldname} values{tiddlername!!fieldname}  if it 
> could parse this with spaces as the delimiter then numeric lists in a 
> variable will not be deduped and can feed into our maths operators.
>

I think this is the existing "enlist" operator.

-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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/c7c4481c-8d2f-451d-b663-35599e954d96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread TonyM
Also

values[1 2 1 2 3]sum[]

Regards
Tony

On Tuesday, June 4, 2019 at 4:56:02 PM UTC+10, TonyM wrote:
>
> Mario,
>
> Smiley Face :)
>
> Do you think we could also provide values with other inputs like 
> values values{!!fieldname} values{tiddlername!!fieldname}  if it 
> could parse this with spaces as the delimiter then numeric lists in a 
> variable will not be deduped and can feed into our maths operators.
>
> Perhaps values:field[fieldname] would also be valid extracting all values 
> in all tiddlers with field name.
>
> My only concern is the operator name "values" is a very generic word and 
> we will have a need for more with the maths operators. 
>
> So given the above perhaps this would be safer. 
> [datatiddler(s)]values:data[]sum[]
> [tiddler(s)]values:field[fieldname]sum[]
>
>
>
> Regards
> Tony
>
>
> On Tuesday, June 4, 2019 at 4:44:12 PM UTC+10, PMario wrote:
>>
>> Hi Folks, 
>>
>> Just had a look at the code. ... It shouldn't be that hard. 
>>
>> I would like to have {{{[[data]values[]sum[]]}}} ... Which should show 2 
>> if the above content is a tiddler named: data. 
>>
>> I do have a new "values" operator working. I'll create a pull request 
>> today. 
>>
>> BE AWARE!! *The code above doesn't work atm*. ... It will work in 
>> 5.1.20, if Jeremy merges the pull request. 
>>
>> have fun!
>> mario
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/401a3858-215e-4931-a556-73e0d54c40c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread TonyM
Mario,

Smiley Face :)

Do you think we could also provide values with other inputs like 
values values{!!fieldname} values{tiddlername!!fieldname}  if it 
could parse this with spaces as the delimiter then numeric lists in a 
variable will not be deduped and can feed into our maths operators.

Perhaps values:field[fieldname] would also be valid extracting all values 
in all tiddlers with field name.

My only concern is the operator name "values" is a very generic word and we 
will have a need for more with the maths operators. 

So given the above perhaps this would be safer. 
[datatiddler(s)]values:data[]sum[]
[tiddler(s)]values:field[fieldname]sum[]



Regards
Tony


On Tuesday, June 4, 2019 at 4:44:12 PM UTC+10, PMario wrote:
>
> Hi Folks, 
>
> Just had a look at the code. ... It shouldn't be that hard. 
>
> I would like to have {{{[[data]values[]sum[]]}}} ... Which should show 2 
> if the above content is a tiddler named: data. 
>
> I do have a new "values" operator working. I'll create a pull request 
> today. 
>
> BE AWARE!! *The code above doesn't work atm*. ... It will work in 5.1.20, 
> if Jeremy merges the pull request. 
>
> have fun!
> mario
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/0ea411ef-6ac5-4a85-9ac9-a9ad3be9fb84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread PMario
Hi Folks, 

Just had a look at the code. ... It shouldn't be that hard. 

I would like to have {{{[[data]values[]sum[]]}}} ... Which should show 2 if 
the above content is a tiddler named: data. 

I do have a new "values" operator working. I'll create a pull request 
today. 

BE AWARE!! *The code above doesn't work atm*. ... It will work in 5.1.20, 
if Jeremy merges the pull request. 

have fun!
mario


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/9859d722-c9bd-457e-b0ac-80d49bcee5d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread Watt
Will do. All working on the pre-release so far. Thanks again, enjoy that snow.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/af0c951e-ffaf-4e0f-b651-b1481b5d7b26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread TonyM
Watt,

Remember this is using sum which is in the pre-release. Be careful using 
this for production. Be ready to export your content and re import it when 
the full 5.1.20 release is available.

If you wanted it working in pre 5.1.20 you could use evans formulae plugin 
or the calc widget (search here or tiddlywiki.com)

Regards
Tony


On Tuesday, June 4, 2019 at 3:58:33 PM UTC+10, Watt wrote:
>
> Thank you so much TonyM! Those are very useful solutions which I would 
> never have worked out myself. I'm sure others will find them helpful too - 
> adding and counting data tiddler values must be a common requirement but I 
> couldn't find anything on the forum. My run stats are now reborn. "Life is 
> like a box of chocolates".

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/5fda0594-8ed9-451d-a761-24b0d70c41b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread Watt
Thank you so much TonyM! Those are very useful solutions which I would never 
have worked out myself. I'm sure others will find them helpful too - adding and 
counting data tiddler values must be a common requirement but I couldn't find 
anything on the forum. My run stats are now reborn. "Life is like a box of 
chocolates".

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/29c4efc9-b225-48a3-a6c1-f6c4a9dc59c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread TonyM
Further improvments

Note Split[ ] contains a space

\define all-values(data-tiddler) <$list filter="[[$data-tiddler$]indexes[]]" 
variable=item> <$view tiddler=Data index=<>/>

all-values: "<>"

<$wikify name=string text="<>">
String: "<>"

<$set name=result filter="[split[ ]sum[]]">
 Set sum Result: <>



<$set name=result filter="[split[ ]count[]]">
 Set Count: <>

 
 
 
<$list filter="[split[ ]sum[]]" variable=datum>
 List Result: <>






<$list filter="[split[ ]]" variable=datum>
 List Item: <>








Count exact number of items with value "1" in prefix/suffix


<$set name=result filter="[split[ ]prefix[1]suffix[1]count[]]">
 Set Count: <>



<$set name=result filter="[split[ ]prefix[1]suffix[1]sum[]]">
 Set Sum: <>



<$list filter="[split[ ]prefix[1]suffix[1]count[]]" variable=result>
 List Result Count: <>



<$list filter="[split[ ]prefix[1]suffix[1]sum[]]" variable=result>
 List Result Sum: <>



Best Method? (with Wikify)
Use this {{{ [split[ ]prefix[1]suffix[1]count[]] }}}
Or  this <$text text={{{ [split[ ]prefix[1]suffix[1]count[]] }}}/>

If values only 0 or 1 use `{{{ [split[ ]sum[]] }}}` giving {{{ 
[split[ ]sum[]] }}}





I believe further improvement is possible.

Regards
Tony

On Tuesday, June 4, 2019 at 1:30:14 PM UTC+10, TonyM wrote:
>
> Watt,
>
> I have it working in an inelegant way. It only works if the values are 0 
> and 1 because summing all ones is also a count of all one's
>
> I will post here without explanation other than unless I use wikify the 
> split[ ]sum[] will not work
> \define all-values()
> <$list filter="[[Data]indexes[]]" variable=item>
> <$view tiddler=Data index=<>/>
> 
> \end
>
> all-values: <>
>
> <$wikify name=string text="<>">
>
> String: <>
>
> <$set name=result filter="[split[]sum[]]">
>  Set sum Result: <>
> 
>
> <$set name=result filter="[split[]] +[count[]]">
>  Set Count: <>
> 
>  
>  
>  
> <$list filter="[split[]sum[]]" variable=datum>
>  List Result: <>
> 
>
> <$list filter="[split[]]" variable=datum>
>  List: <>
> 
>
> 
> The result of Set Count: and List: demonstrates it is still not perfect.
>
>
> I am not so practiced with Data Tiddlers. 
>
> Regards
> Tony
>
>
> On Monday, June 3, 2019 at 11:00:22 PM UTC+10, Watt wrote:
>>
>> Thanks TonyM, yes it's a data tiddler with index:value pairs. 
>>
>> 01:1
>> 02:0
>> 03:1
>> 04:1
>> 05:0
>> etc.
>>
>> Any clues on counting the '1' values much appreciated. 
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/914facdf-e3cb-4b47-b20f-8e5fc3c36617%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Count data dictionary values

2019-06-03 Thread TonyM
Watt,

I have it working in an inelegant way. It only works if the values are 0 
and 1 because summing all ones is also a count of all one's

I will post here without explanation other than unless I use wikify the 
split[ ]sum[] will not work
\define all-values()
<$list filter="[[Data]indexes[]]" variable=item>
<$view tiddler=Data index=<>/>

\end

all-values: <>

<$wikify name=string text="<>">

String: <>

<$set name=result filter="[split[]sum[]]">
 Set sum Result: <>


<$set name=result filter="[split[]] +[count[]]">
 Set Count: <>

 
 
 
<$list filter="[split[]sum[]]" variable=datum>
 List Result: <>


<$list filter="[split[]]" variable=datum>
 List: <>



The result of Set Count: and List: demonstrates it is still not perfect.


I am not so practiced with Data Tiddlers. 

Regards
Tony


On Monday, June 3, 2019 at 11:00:22 PM UTC+10, Watt wrote:
>
> Thanks TonyM, yes it's a data tiddler with index:value pairs. 
>
> 01:1
> 02:0
> 03:1
> 04:1
> 05:0
> etc.
>
> Any clues on counting the '1' values much appreciated. 
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/6c77d1ec-4c1d-4b14-bd7e-55e2473622f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.