Data storing and recalling

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Wynn
Posts: 4
Joined: Mon Jul 12, 2010 10:16 am

Data storing and recalling

Post by Wynn » Fri Feb 18, 2011 12:37 pm

Hi guys,

I am in need of some help with data recalling and storing.

I'm working on something which requires the user to input a set of variables, and be able to recall all of those variables at a later time by entering any one of those variables.

For example:
The user inputs 1VarA, 1VarB, 1VarC and 1VarD. This is then stored somewhere.
Then the user inputs 2VarA, 2VarB, 2VarC and 2VarD. This is stored somewhere else.
Now, when the user wants to search for that set of variables all they need to do is type in one of those variables for the others to show up. So for the first set of variables to pop up the user needs to input any one of those 4 from the first set.

The main problem i am having is linking up those variables to one another. I can get the language to recall one of these variables but i need it to bring up the entire set. I just need to know how to link up these variables.

Thanks.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Data storing and recalling

Post by BvG » Fri Feb 18, 2011 4:18 pm

I have no clue what you actually mean, sorry. Therefore a random script, maybe it is what you want?

Code: Select all

local 1VarA, 1VarB, 1VarC, 1VarD
on mouseUp
   if field "2VarA" = 1VarA then
      put 1VarA, 1VarB, 1VarC, 1VarD
   end if
end mouseUp
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Data storing and recalling

Post by dunbarx » Fri Feb 18, 2011 4:43 pm

Try this in the script of a field:

Code: Select all

on enterinfield
   put me into temp
   put item 1 of me into tGroup
   set the tGroup of me to temp
   put "" into me
end enterinfield

on keyDown var
   put var after the selection
   put the customProperties of me into temp
   combine temp with return
   
   if the length of me = 5 and me is in temp then
      put me into tGroup
      put the tGroup of me into me
   end if
end keyDown
I worked this with the exact examples you originally posted. You enter data, and when the enter key is pressed, your data is stored as a set of custom properties in the field itself.
If you enter data that already exists, the property is loaded into the field.

Now this only retrieves when the first item in a data set is entered, since I have named the properties after that first item. But it should get you started. You may have to worry about return, delete, backspace, editing in the middle of the text, etc.

Craig Newman

Post Reply