Tinderbox - Bernstein_2015 - Actions and Dashboards

download Tinderbox - Bernstein_2015 - Actions and Dashboards

of 67

Transcript of Tinderbox - Bernstein_2015 - Actions and Dashboards

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    1/67

      t ions

    an

    as

    Mark ernstein

    © Copyright 2015 by Eastgate Systems, Inc. All Rights Reserved.

    Tinderboxr is a trademark of Eastgate Systems, Inc. All other trademarks herein are used illustratively and are

    the property of their respective owners.

    The story and example expense account data used here is a work of fiction. All persons, places, and institutions

    mentioned therein are imaginary, and any resemblance to actual places, institutions, or persons alive or dead, is

    entirely coincidental.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    2/67

    Table of ontents

    1

    Actions and Dashboards

    2

    A Look At The Data

    3 Collecting Notes with Agents

    4

    Summarizing Agent Information With Display Expressions

    5 Summarizing Agent Information With Dashboard Notes

    6 Actions For Automating Routine Chores

    7

    Progress Bars

    8 Seeing The Data

    9 Treemaps

    2

    6

    12

    23

    33

    40

    47

    55

    60

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    3/67

    1.

    Actions and Dashboards

    Tinderbox is the tool for notes, a unique and powerful approach to

    visualizing, organizing, and sharing information about complex problems.

    2

    Tinderbox makes it easy to make notes, even for ambitious and complex

    projects that may last for months or years and may take unexpected twists

    and turns. Tinderbox can actively work with you, taking actions to help keep

    your notes organized and to help you visualize and understand them.

    If you d like to know more about the design of Tinderbox and why it behaves

    as it does, you may enjoy The Tinderbox

    Way

    a book about Tinderbox that is

    published by Eastgate. (order here)

    You don t need to read this

    There are lots of ways to use Tinderbox. The approach here is not the only or

    the best way to use Tinderbox. As you use Tinderbox, you will notice many

    alternate ways to do things; don t assume the method used here is the best

    for you.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    4/67

    3

    If you re just getting started with Tinderbox, you might want to read some of

    etting Started With Tinderbox

    first. You ll find that tutorial in the Tinderbox

    Help menu.

    Actions can help reduce boring and routine chores, freeing you to

    concentrate on matters that do require your full attention. They can help

    avoid mistakes and oversights, such as filling in dates or copying routine

    metadata. Not every Tinderbox project requires lots of actions. If you find it

    easier to do something yourself, there may be no reason to have Tinderbox

    do it for you.

    Things hange

    This tutorial was originally written for Tinderbox 6.3. New versions of

    Tinderbox appear frequently, and the version you re using is probably newer.

    Nearly 100 official Tinderbox versions have already been released to

    customers, and updates arrive frequently.

    Details of the sample document may have changed since the screen shots in

    this tutorial were captured, and as a result some of the results will differ

    numerically from those illustrated here.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    5/67

    4

    Some details discussed here may vary from the version of the program you

    are using. Don t worry too much: the underlying principles and concepts still

    apply. If you re stuck, feel free to ask on the Tinderbox Forum, or email

    Eastgate.

    The roblem

    In this tutorial, we 11explore and analyze some expenses incurred during a

    fictional business trip. The sample data and analytical tools can be found in a

    Tinderbox document you can download from:

    http:/ /www.eastgate.com/ download/ ActionsAndDashboards.dmg

    In this tutorial, we explore some ways we can use Tinderbox to automate,

    analyze, and visualize this rather mundane information. Realistically, you

    would be unlikely to want to invest this much care in such mundane and

    manageable data, but the same techniques can be applied to your own,

    subtler problems.

    Suspend your disbelief: If you re confronting problems that don t seem

    analogous to those described here, Tinderbox might still be able to help.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    6/67

    Again, ask in the Tinderbox forum, where lots of Tinderbox users welcome

    such questions, or email Eastgate.

    ther Resources

    Other places to find information about Tinderbox include:

    Tinderbox Help, a detailed manual found in the Help menu.

    Getting Started With Tinderbox, a tutorial found in the Help menu.

    The Tinderbox Forum, http://eastgate.com/Tinderbox/forum/, is an active and friendly

    meeting place for active Tinderbox users from a wide range of fields.

    aTbRef - a Tinderbox Reference - is a technical reference for Tinderbox written by

    Tinderbox user Mark Anderson and available both as a web site and a Tinderbox

    document at http://www.acrobatfaq.com/atbref6/.

    Mark Bernstein s book he inderboxWay discusses the core ideas that underlie

    Tinderbox. t is available as an eBook from Eastgate.

    5

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    7/67

    2 A LookAt TheData

    Lise Nakamura is Vice President of Design at TK Corporation. an

    international technology company that creates tools to help parents keep

    track of what their children are doing

    1

    • In an increasingly complex and

    mobile world, TK s products have been wildly successful and the underlying

    technology has found spinoff opportunities in fields ranging from warehouse

    management to law enforcement.

    6

    On April 24, the weekly meeting of the Executive Planning Committee

    discussed repeated delays and performance issues with the overseas supply

    chain for the company s crucial new product, slated to be announced in a

    mere four months. The natural person to look into these problems is Don

    Frost, VP of Operations and Nakamura s supervisor. Unfortunately, Frost is

    not available until April 28: he is recently divorced and his daughter is

    competing in an invitational tournament in Chicago this weekend. CEO Ken

    Biggs is reluctant to wait, and the committee agrees that Nakamura will

    leave for the Paris office on the first available flight.

    1

    All the people places and institutions mentioned here are fictitious or are used fictitiously.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    8/67

    Over the course of the following weeks, Nakamura visits a number of cities

    across Europe and North Africa, meeting with TK personnel, contractors,

    vendors, government officials, heads of charitable foundations and other

    stakeholders in order to understand the causes for these problems.

    The first, leftmost tab in the example Tinderbox document is simply a list of

    expenses incurred during this trip.

    e =- Expense Account. tbx Ed'tec

    I=I xpen.. . Chara ... I~ lnfrastr .. . - Status ii] Protot... = Chara...

    laBJ

    xpen . . cities

    ~-'-~~~~-'-,.-~~___;:_~~~--

    +

    Expense Account

    T L

    Expense Account

    HTML Prev iew

    T L

    Boston

    0

    Friday lf

    April

    +

    ti O (±)

    Friday,2'+pril

    ...

    ti flight to Paris

    Start Date

    4/24/2015, 6:33 PM

    Cl

    lunch

    Sent abroad without notice or advance planning

    El

    guidebook

    during weekly Executive Planning Committee.

    Purpose: troubleshoot repeated delays and

    ti

    power adapter

    quality issues that imperil the crucial TK launch .

    0

    [j

    maps

    Authorization : Ken Biggs, oral ( Why are you

    T L

    Paris

    still here? )

    ti

    Saturday, 25 April

    Note to Accounting: the overnight bag I keep in

    Cl

    car to hotel

    my trunk is meant for overnight trips to New

    ti

    evening dress

    York or SF. It's not up to open-ended European

    jaunts. This is going to cost a fortune. If you have

    Cl

    taxi

    tears, prepare to shed them , and consider the

    ti

    Sunday, 26 April

    ramifications of a delayed or botched product

    [j

    lunch

    launch.

    7

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    9/67

    This list contains three kinds of notes. Each type of note has its own

    prototype and appearance:

    1

    City notes are containers for each major stop in Nakamura s trip. Their

    titles are bold

    8

    2. Summary notes briefly outline each day s business, both for mandatory

    record-keeping and to provide context to the Account Department when

    they come to authorize reimbursement. Their titles use the

    Sketchnote

    font.

    3. Expense notes describe one expenditure, explaining who was paid, how

    the payment was made, and occasionally providing additional detail for

    the benefit of the Accounting or Legal departments. Their titles use plain

    font.

    Prototypes

    Click on the Prototypes tab to see the prototypes used in this document. In

    the upper right-hand corner of the map, the adornment named

    Data

    Prototypes contains prototypes used to characterize these expenses:

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    10/67

    City

    Summary

    Draft Summary

    Expense

    The prototype defines wh t sort of note each note is. Every expense record

    adopts Expense as its prototype, so it's easy to find expenses and separate

    them from other notes.

    Second, the prototype defines the base appearance of each note. The

    distinctive font and color the Summary notes and the bold font of City notes

    are inherited from the prototype; we don't need to remember to set these

    9

    manually, and have no worries about

    accidental inconsistencies.

    e ,., xpense Account.tbx Edited

    ~ ~ ~ ~-- =~--~~---~ ~~- -m~ .. ~.

    Third, each prototype defines some key

    attributes that are particularly relevant to

    notes of that type.

    • City simply records the Currency typically

    used in that place and the StartDate of our visit to that city.

    • Summary uses StartDate to record the day it summarizes.

    ~ ncy

    §rt oate

    HTML Preview

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    11/67

    • Each Expense records a list of information about a single expenditure.

    $StartDate is the date of payment, and $City is the place where the

    payment was made. $Recipient is a user

    attribute where we record whom we paid.

    We record the $Amount we paid, the

    $Currency we used, and the equivalent of

    this payment in US $Dollars

    2

    $Method

    records whether the recipient was paid in

    cash or credit card. Finally, $Tags holds a

    set of tags that will help us (and the

    ----------

    • HTML Preview

    o Expense

    Accounting Department) categorize and account for each expense. Tags

    might include lodging , travel , meals (with additional tags such as

    lunch and dinner ), as well as tags about client accounts or projects

    associated with the expense.

    Every expense needs to record this information. It does us little good, for

    example, to know that we spent 46.50 on dinner in Zurich if we forget to

    10

    2

    Later we will arrange this Tinderbox document so it automatically performs the currency conversions for us and fills out many of

    these fields automatically. If we expect to have only a few expenses over a short period of time we could simply fill these out

    manually; if we will be using this project daily for months or years we might eventually decide to automate some of the more tedious

    or error-prone chores as we have done in this example.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    12/67

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    13/67

    12

    3

    Collecting Notes with Agents

    Tinderbox agents constantly scan your document, looking for notes that

    match their specific criteria. When an agent finds a note that satisfies the

    agent's

    query

    it creates an alias of that note inside the agent. The agent may

    perform an

    action

    on the matching note. Finally, the agent may sort the

    aliases it has gathered.

    In this chapter, we will focus on agent queries - on the ways agents look for

    notes that interest us.

    To begin, open your copy of the Expense Account sample document and

    select the tab labeled Examples . This container holds a number of simple

    agents discussed below. As you read, feel free to add your own agents to this

    container.

    Collecting Expenses

    The first agent in the Example is named All Expenses, and collects every

    note that uses the Expense prototype. In outline view, click on All Expenses

    to select it, and click on its disclosure triangle to expand it. Inside the agent,

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    14/67

    you will see a 1 ng list of aliases' one _.___ ._ A... ....io___,,_s ____c_o..._ Ex_,,e_n_se A,__c_ou..,t

    for each expense recorded in the

    4

    T

    entire document.

    With

    ll

    Expenses selected, open

    the Inspector by choosing

    Inspector

    from the Windows menu. Select the

    Action Inspector, marked with a

    e

    icon, and choose the Query pane.

    This Query is simply a logical

    expression which is applied in turn

    to every note; if the result is true, the

    note's alias is gathered by the agent,

    while if the result is false the agent

    takes no further action on that note.

    Agent: All Expenses

    Query: $Prototype== Expense

    ll Expenses

    Action Rule Edict Sort

    Examples: Items Found

    $Text.contains{ Lincoln ); 51

    $Prototype-=' Person ;

    $Prototype== Expense

    D

    Case insens itive Priority

    I

    Normal

    --- ---

    13

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    15/67

    14

    The unusual operator == is the comparison operator, and is true if two things are equal.

    We use it here to avoid confusion with the assignment operator = , which sets the value

    of an attribute.

    Note that, in the right-hand corner of this pane, Tinderbox displays the

    number of notes currently found by this agent.

    Sorting Expenses

    Next, switch to the Sort pane of the

    Action Inspector. Here, we choose

    how the aliases inside the agent

    should be arranged. Initially, they

    are sorted using the system attribute

    $StartDate, in the Event category.

    The expenses are arranged in

    chronological order, with the first

    expenses - lunch at the airport and a

    Paris guidebook- at the top and the

    latest expenses at the bottom.

    We can easily choose different

    e e Act ion Inspector: Expense Account

    All Expenses

    I

    Query Act ion Rule Edict

    Sort

    By

    reverse

    I StartDate I case -sens itive I~

    and by

    _d_o_n_t _o_rt~ -- - l_c_a_e_-s_e_s_t1_ve~ _. B_

    r

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    16/67

    15

    sorting criteria. Be sure that All Expenses is still selected, and click on the

    Sort By pulldown menu and select Dollars from the User category, near the

    top of the menu. The list is now sorted by expense, starting with a $4.99

    downloadable map. Click on the reverse

    checkbox to invert the sort order;

    now, the first item is our costly same-day flight from Boston to Paris.

    For convenience, collapse the outline disclosure triangle of All Expenses

    before continuing.

    Keeping An Eye On Agents

    The Agents and Rules pane of the

    Tinderbox Inspector provides useful

    information on what your agents are

    doing from moment to moment.

    The upper bar in this inspector is our

    chief interest here. We can see at a

    glance how many agents this

    document contains, and that

    Tinderbox is currently working on

    the agent named meals . The blue

    e e

    Tinderbox Inspector: Expense Account

    4

    Expense Account

    l

    Info

    Agents Rules

    17 agents

    meals

    11 rules

    days

    Indicates the most recently evaluated rule and

    agent. The marker reflects the agent's position

    in

    the document outline

    S

    . I t

    e

    Oed icts

    1mpeno e

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    17/67

    16

    marker gradually moves from left to right as Tinderbox runs agents from the

    start of your document to its end, and you can judge from its progress how

    much time it takes for Tinderbox to bring all your agents up to date.

    ollecting Specific Expenses

    We might use agents to examine some specific expense categories. For

    example, the agent Meals gathers all expenses relating to meals.

    Agent: Meals

    Query: $Prototype==''Expense'' & $Tags.contains(''meal'')

    Sort: $StartDate

    To qualify for this agent, a note must be an expense nd it must have the tag

    meal. The ampersand ( ) is the logical and operator; the query is true if

    its left side is true and its right side is also true.

    $Tags is a set attribute - a list of labels or tags, separated by semicolons.

    The expression

    $Tags.contains(''meal'')

    is true if one of the elements in $Tags is meal .

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    18/67

    Tinderbox knows that if the left side of the

    &

    is false, the result must be false and that

    there is no need for further work. Knowing this can sometimes make your agents more

    efficient.

    Again, view the query and sort in the inspector, and expand the agent in

    outline view to see which notes it has gathered. It's always a good idea to

    examine what your agents find

    ollecting Major Expenses

    We might require special authorization for certain expenses. The agent

    Authorization Required looks for all expenses over $1000, and also for all

    cash expenditures of any amount.

    Agent: Authorization Required

    Query: inside(/Examples/All Expenses)

    &

    ($Dollars>1000 $Method=''cash'')

    The first clause is true for all notes that are inside the agent All Expenses

    inside the container Examples. In this case, we might equivalently have

    written

    $Prototype==''Expense''

    17

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    19/67

    but if All Expenses required lots of computing work to finds its results,

    inside() lets other agents take advantage of that work without having to

    replicate it.

    The second clause

    ($Dollars>1000 I $Method==''cash'')

    18

    is contained in parentheses because we want its result to be true if either the

    cost exceeded the $1000 threshold of if the payment was made in cash. The

    I

    symbol is the logical or operator, and is true if either its left clause is

    true or if its right-clause is true.

    Weekends nly

    Because a proposed cost-control initiative advocates minimizing business

    travel over weekends, we might need to identify expenditures on Saturdays

    and Sundays.

    Agent: Weekends Only

    Query: $Prototype==''Expense'' & ( $StartDate.weekday==6l$StartDate.weekday==7)

    Sort: $StartDate

    The .weekday facet of date attributes returns the weekday as a number,

    where 1 corresponds to Monday and 7 corresponds to Sunday. We sort

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    20/67

    this agent's results by $StartDate for clarity, so expenses from our first

    weekend abroad aren't mixed with expenses from our second weekend.

    May ay

    We might want to locate all expenses from a specific date.

    Agent: May Day

    Query: $Prototype==''Expense'' & $StartDate==date(''5/1/2015'' )

    Sort: $StartDate

    9

    This is simple enough, but does raise a few tricky issues concerning dates.

    First, the date() operator converts strings to dates. The string can be any

    date that Tinderbox recognizes, including dates expressed in your

    computer's local date preferences. If we were using a computer configured

    with British date preferences (in System Preferences:Language and Region),

    we'd write 1/5/2015 in conformance with British usage. Alternatively, we

    could write May 1, 2015 in either in the US or 1 May 2015 in the UK.

    Second, Tinderbox dates always include a time of day. By convention, the

    equality operator

    ==

    s true if two dates fall on the same calendar day. If

    event A begins on Monday morning and event B begins on Monday

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    21/67

    afternoon, then

    StartDate(A) == StartDate(B)

    is true, even though

    S a r t Da t e (A)

    <

    S t a r t Da t e ( B)

    is also true

    3.

    ~aking Timeline

    20

    Lise Nakamura's trip is long and complicated, and the Accounting

    Department might find it a bit confusing. A timeline can help sort things out.

    lzurich

    lvienna Gothenburg Boston

    laoston fnearComo Marra1

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    22/67

    We begin by making an agent to gather all the City notes.

    Agent: All Cities

    Query: $Prototype== City

    Next, we '11 ocus the view to focus only on the results of this agent. Select

    All

    Cities

    and choose

    Focus View

    21

    from the View menu. Finally,

    choose Timeline from the View

    menu. We see a simple timeline of

    the cities visited in the course of this

    • .. Expense Ace

    .

    trip.

    To return to the outline view, choose

    Outline from the View menu and

    then click on Examples in the

    breadcrumb bar to expand the view

    to the Examples container.

    Mistakes Finding Missing Tags

    Expense . rototype-   All Cities haracters = n

    Expense Ac.count

    T l:l JJ

    (±)

    All Cities

    l:l

    Zurich

    l:l

    near Como

    l:l

    Vienna

    l:l

    Gothenburg

    l:l

    Paris

    l:l

    Torino

    l:l

    London: Watchfu/Con

    l:l

    Tel Aviv

    l:l

    Stavanger by car)

    We use $Tags to assign each expenditure to one or more categories, so the

    Accounting Department can handle each expense appropriately. Common

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    23/67

    tags include "entertainment", "transportation", "lodging", and "meals".

    Meals are also tagged with "breakfast", "lunch" or "dinner" where

    appropriate. Tags might indicate particular colleagues or customers whose

    bill was paid, accounts that might be charged for the expense, and other

    short memoranda.

    In the rush of work, we might forget to tag an expense; an agent can easily

    find any expenses without tags.

    Agent: No Tags

    Query: $Prototype==''Expense'' & $Tags==''''

    Only slightly more work is required to locate expenses for meals that aren't

    tagged with a particular meal.

    Agent: No Meal

    Query: $Prototype==''Expense'' & $Tags.contains(''meal'')

    & ($Tags.contains(''breakfast'') $Tags.contains(''lunch'')

    $Tags.contains(''dinner'') )

    The

    " "

    operator is the "not" operator: if what follows it is true, it returns

    false.

    22

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    24/67

    4 Summarizing gent Information With

    Display Expressions

    The agent queries we created in the

    . . ,

    previous section are xpr ssions

    -

    All Expenses:

    alues or combinations of values.

    Another use for expressions is the

    note's Display Expression, a formula

    Tinderbox uses to determine how

    each note should be labelled

    4

    • Each

    note can have its own Display

    Expression, stored in its attribute

    DisplayExpression.

    Subtitle Caption Hover Text

    Color:

    automatic

    Alignment:

    left

    Map

    Size:

    l

    14

    Outline

    14

    A

    V

    n Bold

    Display Expression

    0 Strikethrough

    The Title pane of the Text inspector

    lets you inspect and change display

    expressions. Simply type the Display

    Expression in the appropriate text

    $Name+  : +$Ch ildCount

    II

    Display Express ion Enabled

    4

    If a note has no $DisplayExpression, Tinderbox displays the note's $Name. If the note has a $DisplayExpression, Tinderbox

    evaluates the expression and displays the result.

    23

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    25/67

    24

    box and press [Return].

    The Display Expression is a formula, a recipe for constructing the name. Don't confuse

    the expression with its result. Several notes might have the identical expression but, since

    the notes are different, they would display different results.

    ounting Notes

    The first agent we created in the Examples container collected every Expense

    in the document.

    Agent: All Expenses

    Query:

    $Prototype==

    11

    Expense

    11

    To keep track of the total number of

    expenses in the document, we could set

    up this agent to display the number of

    expenses it found in its title.

    DisplayExpression:

    $Name+

    1

    :

    11

    +$ChildCount

    Sandbox

    a place for experimental agents

    All Expenses:

    When applied to strings like $Name, the + operator joins two strings

    together. Thus, Tinderbox starts with the note's $Name, appends a colon,

    and then appends the number of children inside the agent.

    Alternatively, we might write

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    26/67

    25

    DisplayExpression: $ChildCount+'' Expenses''

    to label the agent 55 Expenses.

    Total xpense

    Rather than reporting the number of expenses, we might be interested in the

    cumulative total. Rather than change the agent All Expenses again, we'll

    define a new agent.

    Agent: Total

    Query: inside(/Examples/All Expenses)

    Display Expression: $Name+'': ''+sum(children,$Dollars)

    The query simply matches all notes that the agent named All Expenses has

    found; this is a convenient shortcut that lets agents work together without

    duplicating work.

    The display expression adds up the value of $Dollars for all the agent's

    children, and appends the result to the agent's name. This will display the

    total as a number.

    Total: 16167

    Since we know the result is expressed in our local currency, we might format

    it more suitably:

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    27/67

    Display Expression: $Name+'': ''+sum(children,$Dollars).format(''$'')

    This takes the number

    sum(children,$Dollars)

    and asks Tinderbox to format it

    [Number].format(format-string)

    The $ argument to format means format this number according to the

    computer's local currency formatting. The result will look something like

    this:

    Total: $16,167.00

    26

    The currency symbol and conventions for punctuating currency are based on

    the locale you choose in System Preferences: Language Region.

    irst and Last Notes

    Instead of knowing the total, we might want our agent to tell us about the

    dates covered in its list of expenses.

    Agent: Range

    Query: inside(/Examples/All Expenses)

    Sort: StartDate

    Display Expression: $Name+'': ''+$StartDate(child).format(''l'')

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    28/67

    28

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    29/67

    Alternatively, we might be interested in the largest and the smallest dinner

    expenses. Let's construct the display expression step by step; this is usually

    the best approach to building a complex expression.

    We begin very simply.

    Display Expression: Name+'': ''

    This displays:

    Dinners:

    The

    min

    and

    max

    operators require a list of values. We can create a list using

    the co

    11

    ec

    t )

    function.

    Display Expression: Name+'': ''+collect(children, Dollars)

    This displays a list of dinner bills separated by semicolons:

    Dinners: 153.36;223.65;45.36;46.44;34.56;248.83 ....

    Tinderbox has gone through each of the agent's children, collected its value

    of Dollars, and appended it to this list. To find the smallest bill, we pass the

    list to min():

    Display Expression: Name+'': ''+min(collect(children, Dollars))

    This displays something like:

    29

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    30/67

    Dinners: 20.8

    As before, we'll format the result as currency.

    Display Expression: Name+'': ''+min(collect(children, Dollars)).format('' '')

    which displays:

    Dinners: 20.80

    Finally, we'll add a dash and then find the largest dinner bill:

    Display Expression: Name+'': ''+ min(collect(children, Dollars)).format('' '')

    +'' - '' + max(collect(children, Dollars)).format('' '')

    Which displays something like

    Dinners: 20.80 - 525.00

    30

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    31/67

    Incrementally building and testing complex expressions lets you re.fine your

    work in small and simple steps and helps identify mistakes at once.

    ummaryTables

    In maps, when an agent has located some notes, we

    typically see those notes inside the agent.

    Sometimes, it's more informative to list those notes

    by name, perhaps appending some additional

    columns of information we want to see. We can add

    a

    summ ry t ble

    o any container or agent to do this.

    For example, select the tab named Status and locate

    the agent missing tags . This agent looks for any Expense reports that have

    no tags; because every expense should have some category or explanation,

    31

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    32/67

    we'll need to locate any unexplained expenses before submitting our report

    to the Accounting Department.

    We can inspect the agent's query by selecting

    it and opening the action inspector. The agent

    looks through the entire document and finds

    notes that use Expense as a prototype but that

    have no tags.

    missing tags

    ••)•@M

    ct ion Rule

    Examp es:

    $Text contains( Lincoln );

    $Prototype== Person ;

    Edict Sort

    Items Found

    1

    Protot ype= Expense   &$Tags== 

    The summary table is drawn in the agent's

    title bar below the agent's name, provided

    there's sufficient space. To give us room to

    display the table, select the agent and then

    drag the top of the title bar upward, so the

    title bar fills the agent.

    Z) Case insensitive Priority Normal

    ·--- -

    Next, click on the Summary Table widget, marked

    here with a blue arrow. Each column in the summary

    table is listed in turn: here, we have only a single

    column which lists the note's name. We could add

    additional columns here if we wished. Click

    32

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    33/67

    anywhere outside the Summary Table Properties popover to dismiss it.

    As downloaded, the sample file has no

    untagged expenses and so the summary

    table is empty. Double-click the map

    background to create a new note, name

    it test expense , and use the note's

    prototype tab to select the Prototype

    Expense . After a few seconds, the

    note will appear in the summary table.

    [if You may choose File Update Agents

    Now to ask Tinderbox to update all

    agents right away.

    Summary Table Propert ies

    I

    eading

    Name

    Expression

    Name

    G] - ll

    Use Headings

    Finally, delete test expense ; after a few seconds, the note will disappear

    from the summary table.

    [if Remember to delete the text expense, so it doesn't clutter results in subsequent

    chapt ers.

    33

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    34/67

    5

    Summarizing Agent Information With

    Dashboard Notes

    Display expressions work well if we want to extract one key aspect of an

    agent, provided that we remember to look at the agent. Sometimes, we might

    want to display several aspects of an agent, or of several agents that might be

    scattered throughout your document.

    A Tinderbox

    d shbo rd

    s simply a collection of notes that display summary

    information of interest in a single convenient place. The expense account

    sample file includes a dashboard container named

    Status Click on its map

    view tab for an overview of the entire document.

    A Dashboardote

    The left-hand side of this dashboard has several notes that use the prototype

    Dashboard for a distinctive appearance. The Dashboard prototype is located

    in the Prototypes folder, and has the following properties:

    Color: 3 (matching the background color)

    BorderColor: transparent

    34

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    35/67

    BorderStyle: plain

    Shadow: false

    SubtitleSize: 75

    SubtitleColor: greens

    Using the Inspector to set all these parameters for each dashboard note

    could be tedious, but prototypes lets notes inherit all these characteristics in

    one step, and also let you modify the appearance of all dashboard notes by

    changing the prototype.

    Counting Notes Subtitle

    We begin with the note transactions, which counts the total number of

    expenses found in the entire document. This note has a Rule:

    Name: transactions

    Rule: $Subtitle=$ChildCount(/Infrastructure/all expenses)

    This rule asks Tinderbox to locate the child count of another note - an

    agent named all expenses inside a container named Infrastructure - and

    then to store the result in this note's subtitle.

    s The color green in this document has been defined as #5e8663 - a neutral gray-green.

    35

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    36/67

    Tinderbox constantly evaluates rules, running the rules for each note until it

    reaches the end of the document and then starting over at the document's

    beginning6.

    transactions

    55

    etting The Total

    In the upper left-hand corner of the dashboard, we see a

    note named total cost that adds up the cost of every

    expense in the document. Again, we construct a rule

    which finds the total cost and stores that cost in Subtitle.

    Let's consider how we might write this rule in small and

    simple steps.

    Name: total cost

    Rule: $Subtitle=42

    total cost

    42

    6

    A second kind of rule called an Edict is run less frequently than regular rules and is useful when the result of a rule will seldom

    change.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    37/67

    This is very simple indeed - it takes the number 42 and stores it in

    $Subtitle. Once the rule runs, this dummy value will appear in the dashboard.

    (You may need to deselect the note to allow the screen to update.)

    We'd like the subtitle to be formatted as currency.

    Name: total cost

    total cost

    Rule: $Subtitle=42.format( $ )

    42.00

    Finally, we replace the dummy value with the real value.

    We'll look inside the container named

    Expense Account and total up all the

    dollars expended:

    Name: total cost

    Rule: $Subtitle=sum(descendants(/Expense Account),$Dollars).format( $ )

    tot l cost

    ___1,955.30

    37

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    38/67

    The Places We ve Been

    Each expense entry records the city where the expense was incurred. How

    many cities have we visited?

    First, we need a list of all the expenses. The expression

    find(Prototype==''Expense'')

    builds exactly this list, returning the $Path for each note that uses Expense

    as its prototype. Next, we find the value of $City for each expense:

    collect(find($Prototype=''Expense''), $City)

    Once we have the list of cities, we remove all any duplicates:

    collect(find($Prototype=''Expense''), $City).unique

    and, to wrap everything up, we get the size of the remaining list

    collect(find($Prototype=''Expense''), $City).unique.size

    ities

    14

    So, our dashboard note is:

    Name: cities

    Rule: $Subtitle=collect(find($Prototype=''Expense''),$City).unique.size

    38

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    39/67

    First and Last

    What is the earliest expense associated with this trip? We already have an

    agent /Infrastructure/ all expenses that locates every expense record. It

    keeps the expenses sorted by date, so the earliest expense will be that agent's

    first child.

    StartDate(child(/Infrastructure/all expenses))

    The latest date, conversely, would be

    StartDate(lastChild(/Infrastructure/all expenses))

    For convenience, we can store this data in the StartDate of this

    dashboard note.

    StartDate= StartDate(child(/Infrastructure/all expenses))

    Finally, we format the date and store the result in the dashboard

    note's subtitle.

    Name: start

    Rule: StartDate= StartDate(child(/Infrastructure/all expenses));

    Subtitle= StartDate.format(

    11

    m/d

    11

    )

    st rt

    4 24

    end

    5 7

    39

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    40/67

    How long have we been away? Our start date is now conveniently available

    as

    StartDate(/Status/start)

    and our end date is simply

    StartDate(/Status/end)

    so we can very easily write a note that reports how long we've days

    been away from the office.

    3

    Name: days

    Rule: Subtitle=days( StartDate(/Status/start), StartDate(/Status/end))

    40

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    41/67

    6 ctions For utomating Routine Chores

    In the previous chapter, we used rules to manipulate and move data to some

    dashboard notes. Now, we turn to actions that help keep your information

    organized, consistent, and up to date.

    Tinderbox provides four kinds of actions:

    • Rules are actions that are applied periodically to a single note

    • Edicts are like rules, but are performed less frequently

    • Agent actions are applied to notes that match the agent's query

    • OnAdd actions are applied when notes are added to a container or are

    placed atop an adornment

    Keeping Your Data Consistent

    We use the Tags field, a set attribute, to annotate each expense with

    information about purpose and context. In many cases, the Accounting

    Department requires tags to process each expense and to apply the charge to

    the appropriate account. Other tags are for our own convenience, so we can

    more readily relocate various kinds of expenses.

    4

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    42/67

    For example, all expenses related to transportation should be tagged with

    transportation and also with the kind of transport: plane, train, rented car,

    taxi, and so forth. If we're in a hurry or distracted, we might omit one of

    these tags.

    Click on the Infrastructure tab to view an outline of the Infrastructure

    container. There you will find an agent named taxis that looks for notes

    whose title contains the letters taxi or that are tagged with taxi .

    Name: taxis

    Query: inside(/Infrastructure/all expenses) & ($Name.contains(''taxi'')

    I

    $Tags.contains(''taxi''))

    Action: $Tags=$Tags+''taxi;transportation''

    The action makes adds the tags transportation and taxi to the tags of

    any expense the agent finds. Since $Tags is a set, duplicate tags are ignored;

    if taxi or transportation - or both - have already been added, the action

    leaves them untouched. But if one or both tags were forgotten, this agent

    automatically adds them.

    urrency onversion

    When we add an expense item, we write down the $Amount we paid and the

    $Currency we used. In the US, the value of $Currency will be $ , in the

    42

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    43/67

    UK, $Currency will be £ , in the EU,

    € .

    Our company maintains

    accounts in dollars, and Ms. Nakamura will want to be reimbursed in dollars;

    naturally, we want to be clear and consistent in converting currency

    Inside the Infrastructure container, you will find a container named

    currency conversion that automates conversion of other currency into

    dollars. The first agent, $ , simply copies $Amount to $Dollars since no

    conversion is needed:

    Name: $

    Query: inside(/Infrastructure/all expenses)&$Currency=''$''

    Action:$Dollars=$Amount

    The next agent,

    € ,

    converts euros to dollars:

    Name: €

    Query: inside(/Infrastructure/all expenses)&$Currency=''€''

    Action:$D0llars=$Amount*$ExchangeRate(/Config/euro)

    Whenever this agent finds an expense denominated in euros, it multiplies the

    base amount by the value of the user attribute $ExchangeRate taken from

    the note named euro in the container Config. When filing the expense

    report, we simply fill in the current exchange rate in this note, and all euro-

    denominated expenses will automatically be updated.

    The agent £ does precisely the same thing, using /Config/£:

    43

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    44/67

    Name:

    f

    Query: inside(/Infrastructure/all expenses)&$Currency= f

    Action:$D0llars=$Amount*$ExchangeRate(/Config/f)

    Similar agents convert Swiss Francs (CHF) and Israeli Shekels (ILS). We

    never need to record more than one amount per transaction, and there is no

    risk of an accidental mistake or inconsistency when applying conversion

    rates.

    Saving Steps Copying Currency

    Next, let's revisit the raw expense reports.

    Click the left-most tab Expense Account

    and scroll to the top of the outline. Select

    the note Boston and view its OnAdd

    action in the Action Inspector.

    Boston uses the prototype City and

    inherited this action from its prototype. The

    action contains four distinct steps: whenever

    we add a note inside Boston,

    1. The note's $City is set to the name of its parent,

    which is Boston .

    Act ion Inspector: Expense Account

    L...= ---L....:l __,_ -- ~

    T

    Boston

    Query

    ExarnplE.

    ;iiuolor rnd .

    $City=$Name(parent);

    $Prototype= Expense ; $Currency

    = $Currency(parent); $StartDate

    = $StartDate(prevSibling)

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    45/67

    45

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    46/67

    When we create a note inside a city, Tinderbox takes several actions:

    • Tinderbox guesses that the note is likely to be an Expense, and sets the

    prototype accordingly.

    • Tinderbox guesses that the City in which the expense was incurred

    corresponds to the City in which we were staying. This might be wrong -

    we might have been visiting a suburb or we might have been in transit to a

    new destination - but it's a reasonable first assumption.

    • The currency for the expense is set to the Currency used in that city.

    Again, this might be incorrect, but it's a good first guess. We use the

    conditional assignment operator

    I

    ere so that the assignment is ignored

    if Currency already has a value - if, for example, we're moving an

    expense record that we'd accidentally filed in the wrong place.

    • The StartDate for this expense, if it hasn't already been set, is the same as

    the StartDate for the expense immediately above it. This lets us rapidly

    enter several expenses for the same date.

    OnAdd actions are only performed when we create a note or add that note to

    a new container; they're suggestions, not constraints. If Tinderbox guesses

    that we wanted to make an Expense but we really wanted to create a new

    46

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    47/67

    Summary, we simply change the prototype for the new note. Tinderbox

    might guesses that we had lunch in London, since that s where we are

    staying; if we were actually in Oxford, we simply change the City.

    47

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    48/67

    7 Progress Bars

    Inside the Expense Account container, we have three kinds of notes:

    • Summaries provide narrative context for each day

    • Cities mark arrivals in each new place

    • Expenses record individual expenditures

    It is clearly desirable to record each expense promptly, while the details are

    fresh in our mind. Summaries are indispensable and mandatory, but these

    always pose a problem. First, the traveller is frequently exhausted at the end

    of the day, and the last thing he or she wants to do is to stay up writing a

    narrative for the Accounting department. Second, the key elements from the

    day s activities might not always be immediately apparent, and a few day s

    perspective may help focus the summary on the most consequential matters.

    Nevertheless, the summary is important and ought to be written while

    matters remain fresh in our mind. One section of the Status dashboard keeps

    track of summaries and draft summaries, reminding us of what has been

    done and what remains to do.

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    49/67

    Open the Status tab and scroll to the

    upper right-hand section of the map

    to find the Summaries dashboard.

    At a glance, we see that we have

    written six summaries, one of which

    is very short. We have an additional

    eighteen notes that use the prototype

    Draft Summary . Fifteen have yet

    to be written, and two more are very

    brief.

    If we go to the Expense Account tab,

    we might change the prototype for

    the April 24 summary back to Draft

    Summary. Right-click the icon to

    the left of the note title and select

    I

    I

    I

    Summaries

    Bummaries

    I

    drafts

    I

    6

    1s I

    empty

    I

    empty diafts

    151

    short

    I

    short drafts

    1 2

    ok

    I

    I

    ok drafts

    I

    5

    1

    Draft Summary from the menu of prototypes. Return to the Status tab; we

    find that we have one fewer summary and one more draft. Go back to the

    Expense Account tab and change the April 24 summary back to Summary;

    the Status tab will return to its previous state.

    49

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    50/67

    Working With Progress ars

    Before examining the details of these status-monitoring tools, it may be

    helpful to explore how progress bars work.

    To begin, create a note named Progress. Use the Appearance inspector to

    modify its appearance as follows:

    Color: 6

    Accent Color: 3

    Border Color: black

    Border Style: plain

    Border Width: narrow

    Shadow: off (unchecked)

    Then, use the Text inspector to add a subtitle.

    Title alignment: center

    Subtitle: 42

    Subtitle Color: green

    Subtitle Size: (adjust slide to match illustration)

    Finally, open the Plot pane of the Appearance inspector

    and choose bar from the Pattern menu. Enter

    $Subtitle in the plot's Expression field, and ensure that

    Minimum and Maximum are empty.

    rogress

    42

    2

    50

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    51/67

    If no explicit minimum or maximum are chosen for a progress bar,

    Tinderbox assumes that minimum is O and the

    maximum is 100. As we see above, the progress bar is

    roughly 4 2

    °/o

    ull.

    If we prefer a vertical gauge, we select

    vbar rather than

    bar from the Pattern menu.

    rog ress

    If you now change the subtitle from 42 to, say, 75 , the proportions of

    the bar will be updated to reflect the new value.

    Expected Progress

    Next, select the note named summaries and open the Rule pane of the

    Action Inspector.

    Rule

    $Subtitle=find(Prototype= Summary ).size

    The rule makes a list of all the summary notes in the document, recording the

    size of that list in the note's subtitle.

    51

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    52/67

    Next, switch to the note's Plot

    inspector. The plot pattern is bar

    - a progress bar - and the

    expression being plotted is simply

    the $Subtitle just set in the note's

    rule.

    The bar's minimum value is 0. The

    . .

    maximum 1s:

    1+$Subtitle(/Status/days).toNumber

    We already know the length of the

    trip; in the preceding chapter, we

    recorded the number of days

    between the first and final expense in

    the note days. We might well want

    a summary for both the first and

    final days of the trip, so the number

    of summaries we expect is one

    greater than the number of days in

    the trip. Finally, because $Subtitle is

    e e Appearance Inspector: Expense Account

    T 0.

    summaries

    I

    Interior Border Shadow Bkgnd

    Pattern

    I

    bar

    Expression L---1 _Sub_it_e _____

    __J

    Minimum

    Plot Color

    Background

    lo

    Maximum I

    1

    + Subti11

    I • green

    l O white

    bar( Subtitle,0,

    1

    + Subtitle(/

    Status/days). toNumber)

    52

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    53/67

    a string, we explicitly convert $Subtitle to a number with

    toN urnbe r

    to ensure

    that Tinderbox understands that we want to

    +

    to add two numbers

    together, rather than to append the two strings.

    Spotting Trouble

    We might create Summary (or Draft Summary) notes as placeholders,

    intending to come back later and flesh them out. The note empty finds

    summaries with no text:

    Rule: $Subtitle=find(Prototype==''Summary'' & $WordCount==0).size

    Similarly, empty drafts finds draft summaries without text.

    Rule: $Subtitle=find(Prototype==''Draft Summary''

    &

    $WordCount==0).size

    The notes short and short drafts identify summaries and drafts that are

    very short - less than 100 words long.

    Rule: $Subtitle=find(Prototype=''Summary''

    &

    $WordCount>0

    &

    $WordCount

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    54/67

    days on end. This can leads to long evenings of tedium, forgotten details, and

    unpleasant memos from the Accounting Department.

    The number of draft summaries is a useful indicator that

    paperwork is piling up. For this trip, we might attempt a

    resolution to keep: we'll try to keep the number of

    unfinished drafts down to three or four.

    drafts

    1

    a

    The progress bar's t rget is specified in the Plot Inspector, and may be a

    constant number (here it's 4 ) or an expression. The marker is drawn using

    the note's $PlotColor, alternating with the contrasting color from the

    progress bar.

    olor oding

    Dashboards might want to call attention to problems. In the example above,

    we have too many unfinished drafts: we resolved to aim for four drafts at a

    time, and we currently have 18.

    We can use a rule to change the appearance of notes that require attention.

    For example, we could use this three-part rule (in which we've added some

    extra space a line-breaks for clarity on the page):

    $MyNumber=find(Prototype= Draft Summary ).size;

    54

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    55/67

    $Subtitle=$MyNumber;

    if($MyNumber>4){$SubtitleColor= dark bright red } else {$SubtitleColor=;}

    First, as before, we make a list of drafts, count them, and store the result in

    $My Number. Next, we copy that result to the subtitle. And third, if the

    result shows that we have more than four drafts, we set the subtitle color to

    dark bright red; otherwise, the action

    $SubtitleColor=;

    tells Tinderbox to use the inherited or default $SubtitleColor.

    Many visual properties of dashboard notes can be effective indicators like

    this. $Color and $Color2 change the colors used by

    the progress bar. $BorderColor changes the border

    color and $Border changes its thickness. $Badge adds

    an named image or badge to the note's upper right-

    hand corner.

    if($MyNumber>8){$Badge= alert } else {$Badge=;}

    adds a warning symbol if far too many drafts have piled up.

    drafts

    18

    I

    55

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    56/67

    8.

    Seeing The Data

    Pie Charts

    In Chapter Six, we used a group of

    agents to manage exchange rates,

    converting currency from Euros,

    Pounds, and Krona to dollars. We

    might find it useful to see an

    overview of the fraction of our

    expenses that was remitted in each

    currency. A dashboard pie chart can

    do this at a glance.

    by currency

    os

    0 €

    • HF

    0 £

    • ILS

    0 MAD

    D SEK

    li;?As rule, prefer progress bars and histograms to pie charts. The pie chart is generally

    overused and is frequently uninformative. In addition, readers are not very skilled at

    judging the relative sizes of arcs and wedges, making pie charts hard to read unless the

    reader already knows what the chart means to convey. Still, when you need to examine

    the proportion of a few categories, pie charts can be a good solution.

    To begin, we create an agent "by currency" that collects those agents we

    defined in Chapter 6:

    Query: inside(/Infrastructure/currency conversion)&$AgentQuery =""

    56

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    57/67

    Note that agents always have an AgentQuery, while regular notes have no

    use for one, so locating notes with a query is a good way to locate agents

    7

    Next, select the "By Currency agent, open

    the Appearance Inspector, and select the

    Plot pane. Several settings merit noting.

    • The pattern is "pie", requesting a pie chart.

    e e Appearance Inspector: Expense Account

    '--= '--'-- ___ -'----"

    4____.

    I

    T

    I

    I

    O

    I

    by currency

    Interior Border Shadow Bkgnd

    Pattern pie

    Express ion [sum(chi ldren(orig inal), Dol lars)

    • Each child of the agent represents one

    segment of the pie. In this case, each

    currency agent represents one segment

    Minimum

    [auto Maximum .__ au_to _,

    • Expression can be any attribute or

    combination of attributes we might wish to

    analyze. Here, for each agent, we locate

    all the children of the original agent and

    sum their $Dollars values, giving us the

    total expenditure in each currency.

    • The background of the pie chart is drawn

    Plot Color e black

    ~ J

    Background

    O

    2

    __;;_ _____

    ----- 0

    pie(sum(children(orlginal),

    Dollars))

    0 $

    D t:

    • CHF

    Smart Adornments also have queries, but because agents never examine adornments that need not concern us here ,

    57

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    58/67

    in Color 2', and is opaque.

    The pie chart legend is drawn to the

    right of the chart, if space allows.

    The colors used in the pie chart are

    chosen in turn from a list of colors in

    the note's $PlotColorList; for this

    note, the $PlotColorList is:

    green;lighter green;darker

    green;light green;black;white;blue

    by currency

    O s

    0 €

    • CHF

    0 £

    • ILS

    MAD

    SEK

    If you change the first color from green to red, the segment for $ will change

    color.

    ar Graphsand Plots

    We might perhaps be interested in how our expenses were distributed

    throughout the trip. Are the expenses clustered at the start of the trip or the

    end? We some periods especially costly?

    A quick and easy way to visualize expenses over time is simply to build a

    chronologically-sorted list of all the expenses, and then plot each expense.

    Agent: expenses by day

    e e

    Appearance Inspector: Expense Account

    58

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    59/67

    Query:

    inside(/Infrastructure/all expenses)

    Sort:

    StartDate

    Once again, we request a plot - this time a bar graph

    - inside the a gen

    t

    • The Expression for the plot is very simple: we draw a

    vertical bar proportional to the cost of each

    reported expense.

    • A few plane tickets are especially costly. We choose

    a maximum value of 1000 for the graph's vertical

    axis so small expenses like taxi trips remain visible.

    ii -4

    T

    (lo

    expenses by day

    Interior Border Shadow

    Minimum

    Plot Co lor e green

    Background O white

    bargraph( Dollars,0, 1000)

    • Often, the plot background is translucent to allow us to see notes inside

    the agent or container. For clarity, we choose an opaque white

    background.

    We see some big expenses early in

    the trip - the plane flight to Paris,

    the hotel in Zurich. Costs diminish

    for a time, but seem to gradually

    escalate toward the end of the trip.

    expenses

    by day

    59

    It might also be helpful to see how the costs are distributed. Are there lots of

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    60/67

    expenses for the same amount? Are there anomalous expense reports? The

    agent named distribution of expenses helps us keep an eye on these questions.

    Agent: distribution of expenses (log)

    Query: inside(/Infrastructure/all expenses)

    Sort: Dollars

    Where in expenses yd y we set

    the plot's expression to display

    Dollars, here we use a

    logarithmic scale by displaying

    log( Dollars). We see a fairly

    even distribution of costs, with

    perhaps a somewhat fewer small

    distribution of expenses log)

    expenses than we might otherwise expect. This might suggest that we're

    simply not reporting expenditures that are very small, or that we're simply

    not making small expenditures.

    60

    Expense Account

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    61/67

    Boston Paris London: WatchfulCon

    fri &y, 2tt flight to Saturday, 25 Sunday,26 April Draft: Frida

    lp,b ,,ooh

    I

    IDraft: Saturday, 2 May

    I

    April

    Paris

    April

    registration

    IDraft: Sunday,3 May

    I

    Iunch

    I

    lunch dinner hotel

    I,idebook

    I

    evening dri

    OyM~C'D

    ~~· 

    drinks

    power adapter

    1~D~D

    Tel Aviv

    ~Iaps

    1,.,....

    light: Lor

    DI

    nft,

    ,.,,,,.

    5M,y

    I

    Dnft,

    DD

    ijon Ziirich

    Wednesday,

    Monday, Tuesday, 8

    n [  m

    I

    May

    April

    Vienna

    D

    axi to

    IDraft: Thursday, 7 May

    II

    pharmacy

    Iinner

    : Holmbrich I reakfast (suppl)

    I

    offee c taxi to hotel

    I unch

    I r otol

    I,.,. '''·.

    DD~

    clinic

    I

    M~

    taxi to Alliance

    Against

    Marrakesh

    Exploitation

    I

    Draft: Saturday,9 11

    I

    May I[hotel

    [[ unch

    I

    ear Como

    Wednesd1unch

    [workout clothes

    I

    Ouarzazate Gothenburg

    0[J[J

    [ J -Mm 

    Oraft:Wed1

    breakfast

    I

    =

    Draft: Thursday, Draft: Friday,15

    1ttM ay

    May

    Torino

    Dratt:1

    ar rental

    I

    Draft: Thursday,30 April

    [Bar Z

    I

    Stavanger

    Draft : Saturday,16

    II light

    I

    1

    traffic fine return ren

    flight to l(

    I

    lowers

    May

    ~D

    Boston

    I lunch

    I

    Draft : Sunday, 17 May

    II

    axi

    I

    9

    reemaps

    The Treemap view is designed to display the structure of your Tinderbox

    6

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    62/67

    document in detail by using screen space efficiently. On my Macintosh, an

    outline can only display about 25 notes at a time, but the treemap can easily

    display more than 100 notes while showing how they are related.

    To begin, select the rightmost tab named Expense Account in the sample

    document. This opens a treemap view of the Expense Account container, just

    as the leftmost tab opens an outline view of that container.

    Each note appears in the treemap as a rectangle. If a note has children, its

    interior is divided among its children. Those children, in turn, divide their

    interior space among

    th ir

    children. This continues until we've drawn all the

    notes, or until the notes become too small to see.

    The area of each note is proportional to the number of descendants that not

    contains. Within the parent rectangle, notes are arranged roughly in order,

    right-to-left and top-to-bottom, though Tinderbox can move notes around to

    help make sure everything fits.

    As in other views, click on any note to select that note. Double-click a

    62

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    63/67

    container to focus the view on that container; or use the breadcrumb bar to

    expand the view to the parent note's container.

    Weighted reemaps

    Initially, treemaps apply equal weight to

    every note. We can instead tie the area of

    each note to that note's properties. For

    example, we might make the areas of each

    note proportional to the expense it records.

    In the treemap tab, note the small Info button. Click that button to display

    the the treemap popover.

    The treem p expression can be any

    numerical expression. If a note's

    result is zero or negative, that note is

    omitted from the treemap;

    otherwise, the note's area will be

    Treemap Expression:

    Color Expression:

    Border Color:

    Dollars

    Dollars

    Start:

    11 1

    End:

    11 1

    roughly proportional to the result and the sum of the results of the note's

    descendants.

    Expense Account

    Boston London: WatchfulCon

    63

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    64/67

    flight to Paris

    Paris

    evening dress

    Oyster C registration

    -I

    inner

    I

    _[theater I

    Tel Aviv

    dinner

    flight: London-> Tel Aviv hotel

    r

    Vienna

    clinic

    H olmbrich Security: retainer

    I

    I

    dinner

    ~

    ---- l hote-1 --

    Marrakesh

    hotel

    Dijon Zurich

    ~di=ner ~ -~ho~tel----------

    Ouarzazate

    dinner car rental flight

    LJL

    nea r Como

    flowers I[ otel

    I inner

    Torino

    traffic fine

    I

    eturn renta l car

    Stavanger

    flight

    hotel

    ..

    ..

    Here, the treemap expression is simply Dollars: each Expense note is

    drawn with an area proportional to that expense; bus fares are very small and

    costly hotels are much larger. We also use Dollars for the color expression

    the least costly expenses are white and the most expensive are green.

    64

    Note that the daily summaries no longer appear in the treemap; because they

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    65/67

    do not record an expense, their $Dollars attribute is zero and they are

    omitted. The very-expensive last-minute flight at the start of the trip

    occupies a great deal of space; the pre-flight snack and guidebook, which

    were accorded equal weight in our first treemap, are now tiny slivers to the

    right of the plane ticket. ·:::: ·--~·

    ··- -·--

    -

    ...

    olor oding

    The color expression can be used to

    highlight specific elements in the

    treemap. For example, try this color

    .

    expression:

    if($Tags.contains(meal)){1}else{0}

    -

    --

    -

    ·

    --

    -

    ••

    .. -

    ·-_

    ..

    -·--

    -

    ·-

    -. .··

    ...

    -

    -

    ·-·--

    ·-

    -

    -

    --~

    -

    .

    Expenses for meals will use the End Color; other expenses will use the Start

    Color.

    \¥ e might want to identify transactions that use various currencies. We can

    use the same approach to color transactions in currencies other than dollars:

    if ($Currency ="$") {1}else{0}

    Here, if $Currency is not $ the treemap uses EndColor - light green -

    65

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    66/67

    while if the $Currency is $ the item uses StartColor - off-white.

    Perhaps we want distinct colors for transactions in dollars, euros, and in

    other currencies. We could use nested if() statements to accomplish this:

    if($Currency== $ ){0}else{if($Currency== € ){0.5} else {1}}

    Now, if the expense was in dollars, we use

    StartColor, and if it was in euros, we use a mix

    half-way between StartColor and EndColor.

    Nested if() statements can quickly become

    confusing. Tinderbox lookup t blescan be a handy

    alternative. We begin with a list of values of

    $Currency and the corresponding color value - for

    example:

    $:0; £:0.33; €:0.66; default:1

    · -

    ..

    Each value of interest is paired with its associated value, separated by a

    colon. The special key value def au 1t matches any unspecified value. The

    ColorExpression is now:

    $:0; £:0.33; €:0.66; default:1 .at($Currency)

    To make the result clearer, we use a slightly darker green for EndColor.

    66

  • 8/17/2019 Tinderbox - Bernstein_2015 - Actions and Dashboards

    67/67

    Now, transactions denominated in dollars, euros, pounds, and in other

    currencies can be identified at a

    glance.

    Expense Accom t

    Boston Paris

    ~Dijon

    flight to Paris evening dress

    Zll r1ch

    dinner

    hotel

    u

    I

    inner

    5 Como

    j owers j hotel

    orino

    j

    I- ~

    Even though lookup tables are

    simpler to use than complex nested

    if() statements, typing them more

    than once can be unwieldy. Instead,

    we can store them in a configuration

    note. Just as we refer to

    $ExchangeRate(/Config/£) to find

    the exchange rate for sterling, we

    could save the lookup table in

    $MyString(/Config/treemap). Now,

    our color expr ession is simply:

    ]L

    j traffic fir Ieturn rental car

    IC

    London: WatchfL

    Tel Aviv Ouarzazatle

    Stavanger

    i

    I I

    flight : London- >Tel hotel fligh t

    =

    flight

    Aviv

    registration

    :J

    car rental

    Vienna

    [ °~ ~'~ 

    w~,

    hotel

    hotel

    flight

    Marrakesh

    lw

    [

    I

    $MyString(/Config/treemap ) .at($Currency)