[comp.sys.mac.hypercard] Combining Stacks

rl@sei.cmu.edu (Robin Lampert) (06/30/89)

Does anyone know how to combine stacks?

I know how to do it a card at a time with cut/paste, but
I'd prefer to be able to do it with a single sequence.

I don't want to use a cut/paste script, because that will
turn each background into a new background, so modifying
one of them no longer changes the other cards that were of
the same background -- I'd greatly prefer that it stay the
same background.

For example, if stack Alpha has backgrounds a, b and
c, and stack Zeta has backgrounds d, e, and f.

stack Alpha: a a b c a b   and    stack Zeta: x y z z x

If I merge these stacks using a cut/paste method I'll get
a a b c a b x1 y1 z1 z2 z3 x2
where changing something in background z1 will *not* change
the same thing in background z2 anymore, instead of 
a a b c a b x y z z x
where the z backgrounds are still considered to be the same
background by the stack.  This second kind of combination
is what I want.  

Do you know how to do this?  If you do, I would greatly
appreciate your help.  I'll keep an eye on this bboard for
replies, or you can send e-mail.  Thanks.

-Robin Lampert
best e-mail address: rl@sei.cmu.edu (arpa or internet)
or  ...!pitt!darth!sei!rl or ...!uunet!apexepa!sei!rl (uucp)
or  rl%SEI.CMU.EDU@CMUCCVMA (bitnet)
Software Engineering Institute, Room 4212, Carnegie Mellon University
Pittsburgh, PA 15213-3890                              (412) 268-6818

david@bourbon.ee.tulane.edu (David Kaufmann) (01/09/91)

Here's a problem: I have four different mailing lists in hypercard
stacks. Each mailing list is for a different grouping, with some
significant overlap (this is the way I got them and so transferred
them thus into the MAC and hypercard, as the easiest data base type
program to use--I'm the main user, but others may need to get to it).

One list, for instance, is everybody; #2 is a short list for most
frequently contacted, a third the women's auxiliary, etc. 

The lists are used at the moment almost exclusively for mailing
labels, but I hope to be able to put on other information later (but
that's secondary).

1) What's the easiest way to combine the lists, putting on some tag so
that I can extract names as needed from group 1, 2, 3 or whatever, for
labels?

2) Is hypercard the best program to use (I don't have any others and
this is a non-profit group I work for)?

I realize this may require some extensive scripting, but so be it.

Thanks for the help, and e-mail is ok.

David Kaufmann
INTERNET:	david@bourbon.ee.tulane.edu

Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) (01/10/91)

david@bourbon.ee.tulane.edu (David Kaufmann) asks:
>One list, for instance, is everybody; #2 is a short list for most
>frequently contacted, a third the women's auxiliary, etc.
>
>1) What's the easiest way to combine the lists, putting on some tag so
>that I can extract names as needed from group 1, 2, 3 or whatever, for
>labels?
>
>2) Is hypercard the best program to use (I don't have any others and
>this is a non-profit group I work for)?
 
You have a few options (I'm assuming from your message that lists 1,2,
and 3 are DIFFERENT stacks):
1. Write an overseer stack that will access the appropriate list as
asked for by the user. The appropriate lists are maintained in their
own stacks. The overseer would pull the information out of these lists
and display it for you to work with. You would modify those lists by
via the overseer stack. So, for example, to pull all the names out of
list 2 you might do something like:
on mouseUp
 lock screen
 set lockmessages to true
 push card
 go stack "list 2"
 repeat with i = 1 to the number of cards
   put fld "name" & return after tempStorage -- a container
   go next card
 end repeat
 pop card
 set lockmessages to false
 unlock screen
 put tempStore into card field "so-and-so" --place all the names now.
end mouseUp
 
To modify your lists using this approach you'd do something similar
except in the repeat loop you would have a lines like:
repeat with i 1 = to number of card
 put line i of tempStorage into field "name"
 go next card
end repeat
 
This method could get combersome very quickly.
 
2. Your other option is to write a script that will merge the stacks
into an archive. This wouldn't be to tough if the individual lists are
failry similar you just walk through the lists grabbing data and then
plopping it into your new stack. You'd also set some sort of tab field
that notes where each record came from. Let's say you have 2 different
stacks that contain the same basic info, but are used for 2 different
things (i.e. your list 1 and 2
 
HyperCard can do this sort of work quite effectively. Personally, I
would go with option 2 - combine the stacks into a new stack that
includes a tag field noting what list each record goes with. Then use
that new stack exclusively (addding/deleting/modifying data).
on mouseUp
 lock screen
 set lockmessages to true
 push card --save the current card of the merge stack
 go stack "list 1"
 repeat with i = 1 to number of cards
--Gather in the data now.
  put fld "name" & return after nameStorage
  put fld "address" & return after addressStorage
  put fld "doodah" & return after doodahStorage
  go next card
 end repeat
--Now do the gathering on "list 2"
 go stack "list 2"
 put the number of lines of nameStorage into list2StartsHere
 repeat with i = 1 to number of cards
--Gather in the data now.
  put fld "name" & return after nameStorage
  put fld "address" & return after addressStorage
  put fld "doodah" & return after doodahStorage
  go next card
 end repeat
 pop card
 repeat with i = 1 to the number of lines of nameStorage
  put line i of nameStorage into fld "name"
  put line i of addressStorage into fld "address"
  put line i of doodahStorage into fld "doodah"
  if i <= list2StartsHere then put "list 1" into fld "tag"
  else put "list 2" into fld "tag"
  doMenu "New Card"
 end repeat
 unlock screen
 set lockmessages to false
end repeat
 
That is a crude example of how I might merge 2 stacks with the same
structure into a third stack (already made). A better solution would
probably ask the user for the stacks to merge together for example. In
this case the "doodahStorage" can be whatever you want. I'm using
LIST2STARTSHERE to mark what entries came from list 2 and then setting
(Continued in Next Message)


--  

        Ken Knight, Ken.Knight@f421.n109.z1.fidonet.org
      via The Black Cat's Shack's FidoNet<->Usenet Gateway
          blkcat.fidonet.org   and   Fidonet 1:109/401

Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) (01/10/91)

(Continued from Previous Message)
a tag field (all the necesary fields have been created already by you)
to reflect the origin of the record being read into the new stack.
 
I hope this helps somewhat.


--  

        Ken Knight, Ken.Knight@f421.n109.z1.fidonet.org
      via The Black Cat's Shack's FidoNet<->Usenet Gateway
          blkcat.fidonet.org   and   Fidonet 1:109/401