Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Table expressions
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1453837976

Message started by Jason Craggs on Jan 26th, 2016, 2:52pm

Title: Table expressions
Post by Jason Craggs on Jan 26th, 2016, 2:52pm

Greetings,

Being still rather new to Tinderbox, I am working on using it to create and maintain a running ToDo list. I created 4 items in that container and linked them to the event prototype. One thing I thought of doing was creating a container of ToDo items and then use a Table Expression to count the number of items in that container.  So far I've found this:

if($Prototype += "Event"){$Name+"|"+$SiblingOrder}

The result is a list of items and their position on the list. I've done some looking but haven't found what I'm looking for yet. Can someone point me in the right direction?

Also, along the same lines, has someone created a functioning ToDo list that updates, keeps track of what is due and when, as well as removes the item from the list once the completed box has been checked? I only ask because I'd hate to recreate a wheel.

Many thanks for any help, your time and effort are appreciated.

Cheers,
Jason

Title: Re: Table expressions
Post by Mark Anderson on Jan 26th, 2016, 4:02pm

That code looks a bit odd, '+=' isn't used in queries. Tinderbox is probably helpfully both ignoring the '+' and guessing you're trying to do an equality test which is written '=='. You might also find this guidance on table expressions of help, plus the articles to which it links.
I'll assume you're using the built-in prototype 'Event' prototype. Make these container attribute settings:

$TableHeading:       Task|Due
$TableExpression:   $Name+"|"+$DueDate

That looks good, except the $DutDate is showing a time and we don't need that. On my UK system, I see a date tomorrow like "27/01/2016 20:25" but "27/01/2016" would be better.

We'll use the Date.Format() method and use a date format string to show just the date:

$Name+"|"+$DueDate.format("l")

giving a display like  "27/01/2016". We'll also get the container to show the number of (child) items, via a display expression. To do this:

EITHER set the container's $DisplayExpression to: $Name+"  (+$ChildCount+")"

OR, enter the same in code in the 'Display Expression' box of the Text Inspector

The container 'My tasks' will show a title like 'My tasks  (8)' - assuming the there are 8 child notes.  this code jusy counts the children.  If you want a more complex count, e.g. you have a mix of to-dos and other notes, I'll leave that as an exercise to the reader.


So far, so good. That's the basic model, but you asked about filtering 'done' tasks. We'll use the $Checked system attribute to mark 'done' tasks.  You might want to add $Checked to the key attributes of the 'Event' prototype, this updating the attributes shown in the key attributes of all your event notes (N.B. change the prototype's $KeyAttributes not the note itself).

Now, we want to filter the listing of child notes so we only list the notes that aren't ticked as done ($Checked is 'true', i.e. ticked). Edit the $TableExpression code like so:

if($Checked==false){$Name+"|"+$DueDate.format("l")}

If you've a mix of to-do events of other notes we can filter out the latter:

if($Checked==false&$Prototype=="Event"){$Name+"|"+$DueDate.format("l")}

All the links in the answer are to pages in 'aTbRef', which you may find useful for looking up how to use action code. Note though it is a reference, rather than a tutorial or how to.

I hope that helps. If stuck, do ask.

Edit:typo

Title: Re: Table expressions
Post by Jason Craggs on Jan 27th, 2016, 9:22am

Hi Mark,

Thanks for the quick response and information. Perhaps the reason the code looks a bit odd is that I obtained it from an outdated source:
http://www.acrobatfaq.com/atbref5/index/Attributes/SystemAttributeList/TableExpression.html

or

http://tinyurl.com/jv9hypf


However, the link at the top of the page to the updated version does not work.

I really appreciate the detailed information you provided. However, I have failed to implement them, primarily because I am unsure where to add the code. I've attached two screenshots of where I have tried to implement the code without success. Any additional information you can provide would be greatly appreciated.

Okay, I can't even figure out how to attach my screenshots, so any help on this would also be greatly appreciated as I believe it would be really helpful in this situation :-[.

Thanks again.

Cheers,
Jason

Title: Re: Table expressions
Post by Mark Anderson on Jan 27th, 2016, 9:55am

Hah - the '+' is a typo. I've fixed both the v5 and v6 pages. I note you're using the v5 version. Unless you're not using TB v6, I strongly suggest re-checking against the v6 site's pages - in must cases changing the '/atbref5/' part of the URL to '/atbref6/' should work, although I've re-written some parts of the page.

The forum doesn't allow you to attach/upload files. either place them on your own webspace and post a URL, or if you use drop-box or similar, these allow you to post read-only URLs to files.

The two table-related attributes have no UI as such. Edit: my error. read the next post, before the rest of this one. See this too.

There are numerous methods. The easiest is to open Get Info for the container note. Select 'attributes' in the left-most column, then 'Map' in the next column. Then scroll the attributes list to find the attribute(s) you want. Edit their values.  When you click Return or click away from the attribute's value box the edit is saved.

Title: Re: Table expressions
Post by Mark Bernstein on Jan 27th, 2016, 11:34am

The two summary table attributes, $TableHeading and $TableExpression, do now have a presence in the user interface.  Select the container, and you'll see a gray "table" icon appear to its left. Click the icon and Tinderbox will display a popover that lets you edit the table expression.

You can still use Get Info, of course, to enter the expression yourself.

Title: Re: Table expressions
Post by Jason Craggs on Jan 27th, 2016, 11:44am

Mark,

Thanks for the information. I was not intending to use the V5 version, it just happened that that was the version I came upon. I noticed that you did make the corrections in the code. However, the link at the top of the page still does not work, even when changing the first part of the address. See below.

Not Found

The requested URL /atbref6/index/Attributes/SystemAttributeList/redirect.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

To both Marks, I was able to find the summary table attributes in the user interface, as shown in the getting started guide - which by the way is an excellent foray as an introduction to the product. That said, I'm still having troubles achieving the results I'm seeking, even after entering the code Mark-A posted. I will take a couple of screenshots and find a way to share them using the suggestions Mark-A mentioned.

Thanks for all the help, it is really appreciated, and I'll keep you all updated on my progress.

Cheers,
Jason

Title: Re: Table expressions
Post by Mark Anderson on Jan 27th, 2016, 12:50pm

Looks like something broke on the server, which results in the 404; that might tiake some time to fix as atbref5 is only a legacy resource. If you make the URL edit I describe it works fine. Regardless, please go to http://www.acrobatfaq.com/atbref6/index.html and bookmark that; it is the home page for the v6 site.

MB is perfectly right - apoogies. I had a senior moment re the table configuration dialog. It is documented here but needs better cross-referencing the overall aTbRef corpus.

If you - or anyone - does spot errors in aTbref, I really do like to know. The site is only me and there a 3,000+ source notes to keep on top of. Fixes (apart for the redirect above) are pretty easy to fix quickly assuming I know!  :)

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.