Tinderbox Forum

Tinderbox Meetup: Saturday 1 May 2021

Time: Saturday May 1, 2021
9 AM Pacific Time
Noon Eastern time
1700 London
1800 Paris

Come tell us what you’re working on! A great opportunity to explore problems and find new approaches. Everyone’s eager to help!

Hi @eastgate, when will the video of the this meetup be posted?
Thanks!

Should be available later today (3 May)

1 Like

Hi all, here is is the updated TBX file I walked through/shared/produced during the Sat. meeting. It explains how to produce dynamic tables produced from attributes.

TBX L - Building Table from Attributes.tbx (151.1 KB)

See forum post for deeper explanation: Tinderbox Template - Dynamically Built HTML Table: Column Heads from Parent’s $DisplayedAttributes, Row Labels Form Childrens’ $Names

Thanks @satikusala for the demonstration and reference file to build tables. Your approach adds a new dimension to the visualisation of container content in several ways

  1. Well-formatted, attractive and informative tables in TB to explore the content of notes within a container
  2. Formated tables which can be exported via copy and paste to other documents e.g. Word.
  3. The ability to “transpose” (essentially interchange columns and rows) with respect to Note names and note attributes.

The latter was something I was missing so far in TB. The outline view with columns enabled already provides me as a TB user with view of the note contents with the rows fixed to the note $Name and a variable number of columns depending on the attributes I want explore or add. This is illustrated below using your own example TB document.

Note the limitations e.g. Text does not wrap, Column names = attribute names which may or may not be those you would like in the final written communication. Using your example the columns (attributes) become rows using descriptive names and the rows (note $Name) become columns.

Another way to explore your notes for the marketing problem you mention would be to use the cross-tabs capabilities. It’s less useful for formatted output tasks but very useful to explore the content of the notes with two attributes selected. Below an example using your TBX file (not sure why I get the highlight bar at the bottom in this display)

1 Like

You mentioned in your video that the $DisplayedAttributes of the container holding the notes for the table need to be the same as the those of the notes within the container.

I was wondering why I could not use your template in another file of mine, and eventually came across two additional conditions to adapt your template to work in other TB documents

  1. $DisplayedAttributes should not contain $MyString as this attribute is used as a temporary location in the template action code to store the table row content.
  2. String attribute $AtrTable needs to be defined by the user

These edits are likely obvious to expert users but had me flummoxed for 30min or so. I mention them so other users can learn from my experience.

Yes, I did. That is because of the way I produced the action code.

Good point. I was being lazy when I used my $String in this context. Would have been better to have a user-generated attribute.

Yup, in my forum post on this I had pointed that out: Tinderbox Template - Dynamically Built HTML Table: Column Heads Children $Name, Row Labels Parent's $Displayed Attributes

Thanks for calling these issues out.

The cleanest solution would be localised attributes that are defined only in the scope of the action code, since both $MyString and $AtrTable only hold temporarily results of action code and serve no further purpose within the document.

I was wondering whether the var statements I sometimes see in action code examples cover this particular use ?

Another potential improvement would be to retrieve the $DisplayedAttributes to set up the table columns from the first child note of the container so that the container itself is not forced to hold the same $DisplayedAttributes as the children.

I tried that, and it did not work. This makes as the table incrementally builds with additional <td> tags being added to the string with each iteration pass. Thus, each iteration pass needs to be saved somewhere during each iteration. You’ll note that at the end of the template I clear out these temporary attributes so that they’re not holding on to junk. They only get values when the template runs. So, $AtrTRable is necessary. To address the issue of $MyString possibly being used by something else we’d want to create a second temp value, e.g. $AtrTable2.

Yes, this is possible. I tried and thought of that too, but this would require too many other dependencies, such as this and every child has the same prototype or this first child always being the first child, you could not move it, i.e. report the note order to be displayed in the table. I can’t remember off the top of my head, but I also ran into another issue is well when trying to do this.

BTW, we should move this discussion , Tinderbox Template - Dynamically Built HTML Table: Column Heads Children $Name, Row Labels Parent's $Displayed Attributes, so that it is on template post.