Re: results of SPLIT when keys not unique

2017-11-03 Thread Jim Lambert via use-livecode

> Monte wrote:
> 
> Perhaps something like:
> 
> split  by  and  [{replacing | 
> splitting | ignoring} duplicates]


Yes.
+1


Jim Lambert
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: results of SPLIT when keys not unique

2017-11-02 Thread Ralph DiMola via use-livecode
I wyyy over thought this. This is tested:


SELECT animals.animalnumber, animals.animalname
FROM animals
GROUP BY animals.animalname;

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-Original Message-
From: Dr. Hawkins [mailto:doch...@gmail.com] 
Sent: Thursday, November 02, 2017 6:49 PM
To: rdim...@evergreeninfo.net
Cc: How to use LiveCode
Subject: Re: results of SPLIT when keys not unique

On Thu, Nov 2, 2017 at 3:45 PM, Ralph DiMola <rdim...@evergreeninfo.net> wrote:
> Whoops, not tested and I saw an error.
>
> Select mytable.animalname,mytable.animalnumber from (select distinct 
> mytable.animalname from mytable as mytable2) left join mytable on 
> mytable.animalname = mytable2animalname
>

You just shot *way* over my SQL :)

does that last line search for any mytable.animalname that occurs in 
mytable2.animalname?

(and if it's that easy, why in the world isn't DISTINCT ON part of SQLite???

thanks




--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: results of SPLIT when keys not unique

2017-11-02 Thread Dr. Hawkins via use-livecode
On Thu, Nov 2, 2017 at 3:45 PM, Ralph DiMola  wrote:
> Whoops, not tested and I saw an error.
>
> Select mytable.animalname,mytable.animalnumber from (select distinct
> mytable.animalname from mytable as mytable2) left join mytable on
> mytable.animalname = mytable2animalname


You're a bit over my head, but . . .

wouldn't that left join bring *all* the entries for table2 and their
numbers in, so that I would still get repeated animals?

Should there be a . in the middle of the last word?

In test,

Select debtor_table uniqDna, debtor_table cname from  (select
distinct cname FROM debtor_table as mytable2) left join debtor_table
ON debtor_table.cname = mytable2.cname ;

and I get,

   revdberr,Database Error: no such column: mytable2.cname


(in fact, I need cname||cadr, not just name, as some creditors end up
with multiple addresses)


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: results of SPLIT when keys not unique

2017-11-02 Thread Bob Sneidar via use-livecode
The last one of course. 

Bob S


> On Nov 2, 2017, at 15:39 , Monte Goulding via use-livecode 
>  wrote:
> 
> A quick test and it looks like split will clobber any new elements with the 
> same key as those previously parsed. The docs state that only one element 
> will be created but are unclear about which element value will be retained.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: results of SPLIT when keys not unique

2017-11-02 Thread Dr. Hawkins via use-livecode
On Thu, Nov 2, 2017 at 3:39 PM, Monte Goulding via use-livecode
 wrote:

> It would probably be nice to have some explicit syntax to govern this 
> behavior so that you could explicitly declare
> you want clobbering behavior or first come best dressed.

explicit is (almost) always nice (says the guy mulling over a PARALLEL
REPEAT syntax . . .)


>If more than one part of the variable delimited by the primaryDelimiter has 
>the same first portion delimited by the
>secondaryDelimiter, only the element corresponding to the first part is 
>created.

ARGH.  I need stronger glasses.  I even went to the Dictionary and
looked, and couldn't see that phrase . . .


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: results of SPLIT when keys not unique

2017-11-02 Thread Dr. Hawkins via use-livecode
On Thu, Nov 2, 2017 at 3:45 PM, Ralph DiMola  wrote:
> Whoops, not tested and I saw an error.
>
> Select mytable.animalname,mytable.animalnumber from (select distinct
> mytable.animalname from mytable as mytable2) left join mytable on
> mytable.animalname = mytable2animalname
>

You just shot *way* over my SQL :)

does that last line search for any mytable.animalname that occurs in
mytable2.animalname?

(and if it's that easy, why in the world isn't DISTINCT ON part of SQLite???

thanks




-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: results of SPLIT when keys not unique

2017-11-02 Thread Monte Goulding via use-livecode

> On 3 Nov 2017, at 9:39 am, Monte Goulding  wrote:
> 
> It would probably be nice to have some explicit syntax to govern this 
> behavior so that you could explicitly declare you want clobbering behavior or 
> first come best dressed.

Oh… one might also feasibly want output like this I guess:

var[“dog”][1] -> 3
var[“dog”][2] -> 5
var[“cat”]-> 8

Perhaps something like:

split  by  and  [{replacing | 
splitting | ignoring} duplicates]

Cheers

Monte
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

RE: results of SPLIT when keys not unique

2017-11-02 Thread Ralph DiMola via use-livecode
Whoops, not tested and I saw an error. 

Select mytable.animalname,mytable.animalnumber from (select distinct
mytable.animalname from mytable as mytable2) left join mytable on
mytable.animalname = mytable2animalname


Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Dr. Hawkins via use-livecode
Sent: Thursday, November 02, 2017 6:24 PM
To: How to use LiveCode
Cc: Dr. Hawkins
Subject: results of SPLIT when keys not unique

If I use split such that keys are not unique, will that have the effect of
filtering out duplicates?

For example, if I have
  dog 3
  dog 5
  cat 8

and SPLIT it, will I end up with 5 in entry dog?

More specifically, is this a defined behavior, or "just how it currently
works"

I'm trying to find a quick & clean way around SQLite's lack of "DISTINCT
ON"--I need to keep those numbered keys attached to work with, and DISTINCT
alone won't due that.

--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: results of SPLIT when keys not unique

2017-11-02 Thread Ralph DiMola via use-livecode
Would something like this work?

Select mytable.animalname,mytable.animalnumber from (select distinct
mytable.animal from mytable as mytable2) left join mytable on
mytable.animalname = mytable2animalname


Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Dr. Hawkins via use-livecode
Sent: Thursday, November 02, 2017 6:24 PM
To: How to use LiveCode
Cc: Dr. Hawkins
Subject: results of SPLIT when keys not unique

If I use split such that keys are not unique, will that have the effect of
filtering out duplicates?

For example, if I have
  dog 3
  dog 5
  cat 8

and SPLIT it, will I end up with 5 in entry dog?

More specifically, is this a defined behavior, or "just how it currently
works"

I'm trying to find a quick & clean way around SQLite's lack of "DISTINCT
ON"--I need to keep those numbered keys attached to work with, and DISTINCT
alone won't due that.

--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: results of SPLIT when keys not unique

2017-11-02 Thread Monte Goulding via use-livecode
A quick test and it looks like split will clobber any new elements with the 
same key as those previously parsed. The docs state that only one element will 
be created but are unclear about which element value will be retained.

It would probably be nice to have some explicit syntax to govern this behavior 
so that you could explicitly declare you want clobbering behavior or first come 
best dressed.

>From the docs:
> 
> Important: Using the split command can discard data if any of the keys in the 
> original variable are duplicated. If more than one part of the variable 
> delimited by the primaryDelimiter has the same first portion delimited by the 
> secondaryDelimiter, only the element corresponding to the first part is 
> created. (For example, if you are splitting a variable by return and space, 
> and two lines happen to have the same first word, only one of the lines is 
> retained in the array.) Only one element is created for each unique key.

> On 3 Nov 2017, at 9:24 am, Dr. Hawkins via use-livecode 
>  wrote:
> 
> If I use split such that keys are not unique, will that have the
> effect of filtering out duplicates?
> 
> For example, if I have
>  dog 3
>  dog 5
>  cat 8
> 
> and SPLIT it, will I end up with 5 in entry dog?
> 
> More specifically, is this a defined behavior, or "just how it currently 
> works"
> 
> I'm trying to find a quick & clean way around SQLite's lack of
> "DISTINCT ON"--I need to keep those numbered keys attached to work
> with, and DISTINCT alone won't due that.
> 
> -- 
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode