3 Replies Latest reply on Nov 14, 2006 2:49 PM by LynnFredricks

    database advice

    Level 7
      Hi,

      I know database questions have been asked quite often here and I've
      searched through previous posts and found some valuable info. But just
      wanted some extra advice.

      I'm building an aplication that's made of parts. First, you have the
      database management program. This is relaltively simple - just names of
      people with related data for each person. The user can open this
      application, choose a person and change his/her info. The user can also
      add a new person. The information needs to be saved. I was thinking this
      is easy enough to do with Director and saving to an external text file.

      My second application displays a person and his/her info on screen and
      reads this info from the external text file. This application is a
      Director file. These are both done offline.

      So, my question is what adivce do you have on this? Should I just stick
      with a text file. Should I make it a database? If I go with a database,
      what's the most simple one to use?

      Thanks.

        • 1. Re: database advice
          Level 7
          Most of the database xtras come with a database management program. For
          instance, I know that both Valentina and Arca have dedicated programs to
          adding, changing, and otherwise manipulating the data in the database.
          If you don't want that, it is pretty easy to write such a thing, since
          all the database xtras have Lingo functions to read and write to the
          database, so you can make a simple program that is just an interface for
          changing things.

          Making the other part of the program to just display stuff from the
          database is even easier.

          It may be easier (and definitely cheaper) to not use a database per se,
          instead just use Lingo lists. It depends on the quantity and types of
          the data. If you just need it to store name, address, phone number, and
          photo of <1000 people, and the photo portion can be an external image,
          then a Lingo list is the way to go. I just made that 1000 number up,
          there is not real cutoff, but after a list gets real big, it can get
          difficult to manage. I have heard of folks using 10000 item lists
          without problems.

          You can make a program that manipulates the list pretty easily using the
          Lingo commands setAProp, addProp, and deleteProp (check the help files
          for more details on those commands)

          gPersonInfo=[:]
          gPersonInfo.setAProp(#mike,[#email:"mblaustein@gmail.com",#photo:"mike.jpg",#phoneNumber:" 999-999-9999"])

          put gPersonInfo[#mike]
          -- [#email: "mblaustein@gmail.com", #photo: "mike.jpg", #phoneNumber:
          "999-999-9999"]

          put gPersonInfo[#mike][#email]
          -- "mblaustein@gmail.com"

          In this case, I only have info about 1 person. But you can use setAProp
          to set info about as many fols as you want. And if all of the photos
          are in for instance, a folder called "photos" under the folder that the
          Director project is in, you could use a command like this on a bitmap
          sprite to display it *this one is Windows only, if you needed it to be
          Mac compatible, then make sure you can use Mac foldername converntions,
          (i.e. colon as folder delimiter instead of the backslash):

          global gPersonInfo
          on changePhoto me, vPerson
          thisPersonPhoto=gPersonPhoto[vPerson][#photo]
          sprite(me.spriteNum).member.filename=the
          moviePath&"images/"&thisPersonPhoto
          end

          That function will cause the photo to change if you send it a command
          like this:

          sendAllSprites(#changePhoto,#mike)


          As far as saving the database to a file, there are loads of xtras that
          can do it, the best ones, I think is propSave (which is free) or vList.
          In fact, now that I think of it, I believe that both of them can save
          image data into a list, so you may not even need to keep the images as
          external...
          • 2. Re: database advice
            Level 7
            Thanks Mike for your reply. Much appreciated.

            I can see how using lists would be a cheaper option I'm just wondering if the dabse expand if it woudl eb
            better to start with a dbase now. Anywya, may look at some database xtras and do some experimenting, plus
            find out moer details about this projects.

            .

            • 3. Re: database advice
              LynnFredricks Level 1
              If you would like any questions answered about using Valentina, feel free to contact me or visit our very active mailing list.

              Best regards,

              Lynn Fredricks
              Paradigma Software
              Makers of Valentina for Director