Parsing and working with a string

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Parsing and working with a string

Post by SparkOut » Tue Dec 24, 2013 10:05 am

how about a multidimensional array?
eg
put "favoriteColor" into tNewArray[141]["tag"]
put "Blue" into tNewArray[141]["response"]
etc?

I'm still unsure as to how your original array is structured.

But you could:
NOT( (tNewArray[141]["tag"]) = "Blue") AND... then I get lost with wondering where your data came from and how you got it into your response array.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Parsing and working with a string

Post by Simon » Tue Dec 24, 2013 11:35 am

Hello all who are following.
Tonight I have it working... I'll check it again tomorrow, it'll probably be broken :(

I ended up putting all the [tag] as a custom property with [Response] as their value. I save all the answers out into a external data file and load custom properties on openStack.

Anyone know if I can have 2000 custom properties in a liveCode stack?

Ugh!

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Parsing and working with a string

Post by dunbarx » Tue Dec 24, 2013 5:31 pm

I don't think there is a limit to the number of custom properties in a stack, only a limit to how much the human mind can support. But if you have a system...

Craig Newman

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Parsing and working with a string

Post by SparkOut » Tue Dec 24, 2013 6:28 pm

Simon wrote:I'll check it again tomorrow, it'll probably be broken :(
That'll be Santa interfering. He's a jolly chap, but not much of a programmer :D

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Parsing and working with a string

Post by [-hh] » Sun Dec 29, 2013 7:58 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:22 pm, edited 1 time in total.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Parsing and working with a string

Post by [-hh] » Mon Dec 30, 2013 2:32 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:22 pm, edited 1 time in total.
shiftLock happens

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Parsing and working with a string

Post by Simon » Mon Dec 30, 2013 5:40 am

Hi Hermann,
Thanks for this.
I'll make a test soon to see how it compares. Right now my code is working but it's a Frankenstein kludge of code, so I have to change it soon before production.
I will still have to figure out how to apply the switch case as there are over 1000 questions and most are based on previous answers. But I can figure out how to handle that.

"lock screen; lock messages" I've got to remember that.

Thanks again,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Parsing and working with a string

Post by [-hh] » Mon Dec 30, 2013 2:03 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:22 pm, edited 1 time in total.
shiftLock happens

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Parsing and working with a string

Post by Simon » Tue Dec 31, 2013 1:16 am

Ok Herrman you got me,
one can't/won't use a dBase
I don't know DB's that well. There I said it.

Yes, all the questions come from MySQl and I could shove the questions and answers into a local sqLite. But I'm unclear on how to do the search.
I do think that the DB I'm grabbing the info from needs to be more consistent, I'll take that up with the client.

Is it easier to implement DB searches rather than array searches?
Does this
(NOT favoriteColor = Blue) AND ((bestSound = Laughter) OR (bestSound= Dishes clattering in a distant restaurant) OR (happyToday = NO NOT AT ALL))
make more sense to a DB?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Parsing and working with a string

Post by [-hh] » Tue Dec 31, 2013 2:58 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:22 pm, edited 1 time in total.
shiftLock happens

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Parsing and working with a string

Post by Simon » Tue Jun 17, 2014 5:25 am

Hi Hermann,
I have to thank you for the encouragement. Took me 1 day to use it and 6 months to embrace it.
Sqlite is a breeze, absolutely no problems getting it to do what I want.

I'm going to go put my socks into a db :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply