Creating a table with unique values and sum_if counts

Note to mwra: Might it be practical to set $HTMLExportFileName to $Name for every note in the document, e.g. through an agent action? If one did this, then (I think) everything else follows correctly.

I fear that might just shift the problem. A valid $Name can contain characters that aren’t web-safe without further intervention. Plus, we’re sort of fixing the wrong problem.

The issue I created for @Gilberto was that by using part of $HTMLExportedPath for the link anchor text I got a ‘web-ified’ version of the title rather than the value of $Name as might reasonably be expected. My bad for using too-simple test note titles.

I think the real solution here is for an action code wrapper that renders the equivalent of ^linkTo()^.

Crikey @mwra, I’ve just looked through the file and it will take me a couple of whiskeys and a weekend to figure it out (did you load up the right file?)!

I think I’ll keep with the original exercise of just counting the mentions until the functionality is added to TB where I’ll have a prayer of managing the process directly—there’s a lot for me to go away and learn still, and I don’t want to take away more of your time!

Many thanks to you and @eastgate for all your extraordinary help!

1 Like

Yes, I think I did upload the right file. What makes you think it is the wrong one? It is too far back for me to remember the detail so I’ll need something to go on if you need me to check.

The first three example files were called “lists-to-tables.tbx”(2, and 3); this last one is called “TBX L - Build Table With Categories - solution4.tbx”. The first three have relatively simple textual examples, this last one has description codes for a font showing sections of a circle in different colours. You mention that you were putting in the example document name that I sent, but I don’t see it—no problem there, it’s not necessary, but the sections of the last file are completely different from the first three: Prototypes Templates and Codes in the first three, now the document includes very different Templates, a Hints group with a stoplist and other arcana, Harvey Balls (the funky font) font test, etc… Sorry if I’m being thick, but it just looks really different!

Ah, that would explain things. Too many concurrent things to test. Try this: lists-to-tables-4.tbx (195.8 KB)

Sorry about that. :slight_smile:

Thank you so much!!

I’m working through the example—I’ll still need the whiskey and weekend, but at least it follows from the previous examples now. I’ve a crashing error even on your sample file, but the template which you’ve done in the font that’s crossed out (?) seems to work well. So I’ll work through these.

Many thanks again.

The template marked as struck-through was just a test. so, don’t use template ‘Table tag sort reverse lookup - test’, I simply forgot to delete it.

In the file ‘lists-to-table-4.tbx’ container ‘Test cell’ is already set up to use template ‘Table tag sort lookup3’. The reverse sort equivalent template is ‘Table tag sort reverse lookup3’.

The file I posted doesn’t crash, so if you are doing something to crash Tinderbox, look at code or note data you’ve added to it.. wrong, see my next post.

Profuse apologies, I was using a beta for the imminent release. Opened in v9.0.0 I can confirm it crashes. I can also say that the new version, already trailed in recent weekly meet-ups fixes the issue. No point trying to fix it in 9.0.0 as it would need a different approach that I’ve not time to address right now. Wait for v9.1.0 and all should work fine.

Apologies for the confusion. I’ve busy updating aTbRef for forthcoming changes so I’ve been in betas rather than v9.0.0 a lot recently.

1 Like

Oh, sure. This particular solution depends heavily on 9.1 features.

That said, it shouldn’t crash. Could someone send me a crash log?

Will do.

I take a screenshot of the solution4 TB file that @mwra has so kindly provided. On my screen the preview looks like this:

image

What you see is the values of the $Tags attribute as the first column, the number of times it appears in the notes within test cell container in the 2nd column, and, on the right most column, a linked list of the two notes which contain this tag value. The information on display comes from three note elements: $Tags, $Name and the count of each combination of $Tags and $Names (+ access to the contributing notes).

This reminded me that TB has already included another rich view included requiring no action code on the part of the user: the Crosstab. Using the same TB file it was trivial to generate the follow view

Taking the $Tags value of “Cogs” as an example which is summarise in the first column of the cross tab (and the first line in the HTML table in the first approach above) you see the following:

  • the Name of the two notes that contain “Cogs” e.g. “Patrones de producción y consumo sostenibles” & “dog pound”. These appear in brown.
  • the total number of notes containing the tag “Cogs”. The number 2 at bottom of the column tells us this.
  • a clickable link to each note with the Tag containing “Cogs”. These are the vertical stripes you see in the brown boxes in that column.
  • you can also export the resulting counts information as a table in a csv or tsv file if that is useful for you.

@eastgate I also note what I think bug in the CrossTab view. The totals on the right hand side do not reflect the counts across the rows e.g. for the row “dog pound” is should be 3, not 1.

1 Like

Hmmm…I’ll take a look.

I was just thinking about this. I think the current implementation is correct. The total is counting the rows. I think something like this might help:

Add a Row Total in addition to the column total. Also, to be complete we may want the null (what Excel calls Blank) column.

There a two totals (bottom row and final column to the right). It’s still not clear to me what information they convey. My assumption is that they count the number of documents across all rows in the column above (bottom row total) and number of documents across all columns with a given row (final column to the right) as illustrated below. If that is the case then the total in the final column on the right does not reflect this.

I’ll check on this.

Thanks - most important to me to be clear what information the total column/row convey. I’ve not found any mention in the TB Help entry or in the aTBref crosstab entry.

I think I see where the issue possibly lies - using number vs non-number attributes. In the example in aTbRef example image:

Two numerical scores (Ii.e. Tinderbox attribute Number type) are displayed. The ‘total’ in each row or column is the total of the bin counts (the figure above) the box. In the example above the automatic bins span all data in each axis so each row or column no data is unplotted.

But example in @mdavidson’s last post, IIRC, the X-axis bins are set to unlimited so each name has a line, plus tags can appear in several notes and notes can have multiple tags. I think this is confusing the issues. The row total is basically saying there is one item in this row (correct). However, the column title is instances of tags. There are 15 discrete uses of (6 discrete) tags sow the column count total is 15.

So I think using Crosstabs with multi-value (List, Set) attributes is likely the root cause.

Also, it would be useful if the community has some text/example Crosstabs TBX to use as a common reference. It think there needs to be >1 because—as intimated above—purely numeric use is slightly different in use/nature to multi-value lists.