3 Replies Latest reply on Oct 13, 2006 10:50 AM by Chunick

    search a property list

    nevereasy Level 1
      Hi all,
      here's a bit of code that doesn't work! Are we surprised?
      Can someone help me please? I've spent all night on various combinations and computations.

      I always have trouble with 'and' and 'or' but I think that is not my only problem, because with whichever word, it just finds all of my records everytime.

        • 1. Re: search a property list
          Chunick Level 3
          could you please provide an example of how your gDatabase list is structured?
          • 2. Re: search a property list
            nevereasy Level 1
            on newRecord
            record = [:]
            addProp record, #FirstName, ""
            addProp record, #LastName, ""
            addProp record, #passWord, ""
            addProp record, #email, ""
            return record
            end

            Is this what you mean? This is called when a new record is needed.
            I've made some changes to the code in my inital message. I think I have it working now. I've used = instead of contains, with an 'and' and it seems to work. Now i have to make my movie actually "go to that record" ... or modify that record and not any other one, which it seems to be doing.
            The code now looks like this:

            on findMeOnLogIn
            --get search term from field
            getFirstName = member("Entry - FirstName").text
            getPassword = member("Entry - password").text
            -- loop through all records
            repeat with i = 1 to gDatabase.count
            record = gDatabase
            -- see if the record contains the search text
            -- search all properties for it
            if (record.FirstName = getFirstName) and (record.password = getPassword) then
            member("Read FirstName from list").text = record.FirstName
            go to "Welcome"
            member("Record Number").text = "Record No is "&gCurrentRecord --*
            exit
            else
            go to "Register"
            member("Record Number").text = "Record No is "&gCurrentRecord --*
            end if
            end repeat
            end

            *with an extra line added so that I can see what Record is being read.
            • 3. Re: search a property list
              Chunick Level 3
              I'm glad you figured it out. Hope the rest of your project goes smoothly for you :-)