split/combine as table

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

split/combine as table

Post by monte » Tue Jul 02, 2013 6:00 am

Not sure on the best syntax here but what I'd like is something like this:

Code: Select all

split variable {by|with|using} primaryDelimiter and secondaryDelimiter as table
I'm using item for secondaryDelimiter and line for primaryDelimiter in my discussion for clarity...

What this would do is take the first line and use its items as keys in the second dimension of the array and for then each subsequent line would have an array index starting from 1. So the data:

Code: Select all

Greeting,Planet
Hello,Earth
Hello,Saturn
once split would be accessible as:

Code: Select all

theVariable[2]["Planet"] = "Saturn"
A possibly better alternative might be:

Code: Select all

split variable {by|with|using} primaryDelimiter and secondaryDelimiter as table [with keys keyList]
Here if no keyList is supplied then the multi-dimensional array would have a numbered array as the second dimension...

Anyone have any thoughts in this?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: split/combine as table

Post by monte » Tue Jul 02, 2013 6:06 am

Thinking on this some more and I definitely think the keysList way is the way to go because that would cover key ordering in combine.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Apr 13, 2006 6:25 pm

Re: split/combine as table

Post by rkriesel » Tue Jul 02, 2013 9:19 am

If split by row as table gives

Code: Select all

theVariable[2]["Planet"] = "Saturn"
then split by column as table can give

Code: Select all

theVariable["Planet"][2] = "Saturn"
which could facilitate using Jan's MapReduce.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: split/combine as table

Post by monte » Tue Jul 02, 2013 10:32 am

Perhaps I missed something in the map reduce discussion? I'm not really sure how it's related.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Locked

Return to “Engine Contributors”