Add fields from stack in data directory to standalone

Klaus Major klaus at major-k.de
Sun Dec 5 16:05:18 EST 2004


Hi Bob,

> Hi All.
>
> I've not been rev'd up for a while now (new job kept me away). I was 
> looking at the threads regarding saving database data in a file.
> I'm just trying to get my head roung the grand plan before I do down 
> the wrong path like the last time (see database tutorial thread)
>
> Some suggested that you could have a data directory with stack in it 
> and have the standalone reference this... Eureka I thought!!!
>
> OK tall me if I'm right on this please.
>
> Can I have a premade database eg bob1 and make a standalone.

Yes, sure.

> Then have a stack file eg baddresstemplate.rev and  have the data put 
> in a .rev fiel.

???

Maybe that would be overkill, simply because you could actually 
USE/OPEN/EDIT/SAVE
that "premade" database stack!!!

> Would it be something liek this (note: the syntax is made up)......
> On mouse up (on a button called new entry)
> Copy addresstemplate.rev to directory C:\Bobdata

Yes, see below...

>  put the text of field "bobs address" into field1 of card1 of stack 
> addresstemplate.rev

See above AND below :-)

> end mouse up
>
> is this the way to do it?

I suggest the following:

Prepare your complete stack/database "baddresstemplate.rev", test it 
and save it...

Then store it in a customproperty of your standalone!

...
answer file "Where is Bob?"
##select your "baddresstemplate.rev" stack here...
set the my_template_database of stack "xyz" to url("binfile:" & it)
## or "...of this stack..."
...


Then put this into the stackscript of your standalone:

on preopenstack
    if there is not a folder "C:/Bobdata" then
          create folder "C:Bobdata"
     end if
    if there is not a file "C:/Bobdata/baddresstemplate.rev" then
        put the my_template_database of stack "xyz" into 
url"binfile:C:/Bobdata/baddresstemplate.rev""
   end if
   go stack "C:/Bobdata/baddresstemplate.rev"
...
end preopenstack


Now on you can simply edit and SAVE that stack as you would do in the 
REV IDE...

Drop a line if you need more info/assistance...

Hope that helps.

> Cheers
> Bob

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the use-livecode mailing list