Re: Nested lists in MetaCard?

Steve Pothier (starnet!apple!aries.saic.com!pothiers)
Wed, 8 Jun 94 16:32:27 MST

>I want to add some stack scripts that will read a data file (say, from
>standard input) and allow me to brows the data file. Yes, I want
>think I need to use some sort of lists in MC to "mmaintain the links"
>between cards.
>
>Perhaps a hypothetical example would help. Imagine that I have a
>data file that contains geographical data about the US. It might
>contain a "tree" of data as in:
> Alabama
> Arizona
> Senators: XX,YY,ZZ
> Population: 99999
> Counties:
> Pima County
> Tucson
> Area: xxx
> Population: xxx
> Siera Vist
> ... (other cities)
> Pinal County
> ... (other counties)
> ... (other states)
> Wyoming
>
>
>For this example I might have 3 stacks for: states, counties, and
>cities. Each stack contains a homogenous group of cards relating to a
>single level of the tree (eg. the Cities stack contains only cards
>with city information, but from anywhere in the US).
>
>When the user looks at a card in the state stack, she would see
>specific, state related fields filled in (eg. "Senators",
>"Population", "Counties"). Some of those fields would contain links.
>So, if she clicked on a county in the COUNTY field, MC would go to a
>specific card in the COUNTY stack. There would be a similar link in a
>county card that links to all cities for that county.
>
>Now that I have spelled this out a bit more, there are some more
>things that pop to mind. First, I would like to not have to create
>all the cards on creation time (I don't won't to create all the
>COUNTY cards for the state of Arizona unless the user clicks on the
>County field of Arizona). Seconds, it might be reasonable to maintain
>auxiliary "dictionaries" so that a click on ANY chunk in any field
>would result in a dictionary lookup. The dictionary entry would
>contain the stack/card adr of the destination (the other end of the
>link).
>
>-sp-

Sounds like you're the type that solves your problems as you talk (or type)
about them. :-)

... or at least I think I do ... Usually I'm wrong.

Do you plan to have pre-existing stacks for each of the
tree levels before reading data?

Yes. The stacks will pre-exist and all fields that appear in the data
will appear in the stacks.

Creating these as you go, and trying to
lay out card formats on the fly could get very tricky. And then there's
the problem of needing a licensed home stack to create objects from within
a script.

Only some objects require a license. Creating cards is ok.

If you know the format of your data, it's probably best to
include a sub-stack with a 'template' card for each of the possible levels.
When you think about the scripting needed to provide the data links, this
becomes even more of a concern.

As for maintaining the links to lower levels, the easiest method is
probably to just name cards to indicate the data that they contain, as is
done in the MetaCard help stack. For instance, a click on the text "Pima
County" in the Counties field of the States stack would cause the display
of the card "Pima County" in the Counties stack. Umm, I believe that this
handler in the Counties field would do the trick. (But I think the text
would have to be grouped).
on mouseUp
go to card the clickText of stack "Counties"
end mouseUp

Where would you store data that isn't immediately placed on cards? I guess
you could stuff it into globals. Maybe it could all be stored in a hidden
field on the first card of its corresponding stack.

Or even a hidden field on every card. Example: there is a "City"
field, there is also a "(links) City" field.

The dictonary is an
interesting idea. I guess you'd have to include an entry to indicate
whether a card had been created for the data in question.

... or just use the "if there is a card X" phrase.

Thanks for the prompts. I'm getting a better feel already.

-Pothier-