Re: Counting unique items in a file

2020-04-28 Thread Jim Lambert via use-livecode
function getUniqueNames inData,pColumn
split inData by column

split inData[pColumn] by return and return

combine inData[pColumn] by return and space

return inData[pColumn]

end getUniqueNames


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: Counting unique items in a file

2020-04-27 Thread Ralph DiMola via use-livecode
I would change the first line below and add one line and one 
parameter(dateTimeColumn). This assumes that the date/time is converted into 
seconds or milliseconds).

add 1 to uNames[item pColumn of l]["Count"]
if item dateTimeColumn of l > uNames[item pColumn of l]["DateTime"] then put 
item dateTimeColumn of l into uNames[item pColumn of l]["DateTime"]

Then the returned array will still have the keys of all unique drivers and each 
key will have 2 keys "Count" and "Datetime"

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 
Skip Kimpel via use-livecode
Sent: Monday, April 27, 2020 3:29 PM
To: How to use LiveCode
Cc: Skip Kimpel
Subject: Re: Counting unique items in a file

All of that works perfectly.  Thank you everybody!

Let's through a layer of complexity in here... each of of those names has 
another column with a time associated with it, for instance "13:02:58"
 I would like to only show the LATEST time associated with that particular name.

Premise behind this whole exercise:  I have a list of drivers and I want to 
produce a report that shows the driver name, number of jobs (both of these 
accomplished through the last script) and when they finished their last 
delivery.

Should I just break this out into a separate function or would it make sense to 
modify this function to fit these additional needs?

SKIP

On Mon, Apr 27, 2020 at 3:05 PM Skip Kimpel  wrote:

> Silly me... of course.  Thank you, Dunbarx for pointing out the 
> obvious :)
>
> SKIP
>
> On Mon, Apr 27, 2020 at 2:27 PM dunbarx--- via use-livecode < 
> use-livecode@lists.runrev.com> wrote:
>
>> Hi.
>> You are getting empty because the information returned from the 
>> function is an array.
>> "combine " the array with "return and "comma"
>> Craig
>>
>>
>> -Original Message-
>> From: Skip Kimpel via use-livecode 
>> To: Dan Friedman 
>> Cc: Skip Kimpel ; How to use LiveCode < 
>> use-livecode@lists.runrev.com>
>> Sent: Mon, Apr 27, 2020 1:52 pm
>> Subject: Re: Counting unique items in a file
>>
>> Thanks Dan!
>>
>> Upon very quick implementation, I am getting empty results back.  I 
>> think I need to play around with this a little bit more but I feel 
>> you got me on the right track.
>>
>> Thanks again,
>>
>> SKIP
>>
>> On Mon, Apr 27, 2020 at 1:34 PM Dan Friedman 
>> 
>> wrote:
>>
>> > Skip,
>> >
>> > Haven't tested, but pope about this...
>> >
>> > function getUniqueNames inData,pColumn  put "" into uNames  set the 
>> > itemDel to tab  repeat for each line l in inData
>> >add 1 to uNames[item pColumn of l]  end repeat
>> >
>> >  return uNames
>> > end getUniqueNames
>> >
>> > You should get back an array keyed by the unique names, and how 
>> > many instances of each one
>> >
>> >
>> > -Dan
>> >
>> >
>> >
>> > On 4/27/20, 10:25 AM, "use-livecode on behalf of Skip Kimpel via 
>> > use-livecode" > > use-livecode@lists.runrev.com> wrote:
>> >
>> >Good afternoon LC'ers,
>> >
>> >I am loading a tab delimited file into a variable and I need to 
>> > pull out
>> >all unique names from a certain column (let's say column 10) and
>> count
>> > how
>> >many times that name appears in that column.
>> >
>> >I know there has to be an easy way of doing it.  Every time I 
>> > try to start
>> >coding this it get wyyy too long :)
>> >
>> >Simple approach?
>> >
>> >SKIP
>> >___
>> >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
>> ___
>> 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


___
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: Counting unique items in a file

2020-04-27 Thread Skip Kimpel via use-livecode
All of that works perfectly.  Thank you everybody!

Let's through a layer of complexity in here... each of of those names has
another column with a time associated with it, for instance "13:02:58"
 I would like to only show the LATEST time associated with that particular
name.

Premise behind this whole exercise:  I have a list of drivers and I want to
produce a report that shows the driver name, number of jobs (both of these
accomplished through the last script) and when they finished their last
delivery.

Should I just break this out into a separate function or would it make
sense to modify this function to fit these additional needs?

SKIP

On Mon, Apr 27, 2020 at 3:05 PM Skip Kimpel  wrote:

> Silly me... of course.  Thank you, Dunbarx for pointing out the obvious :)
>
> SKIP
>
> On Mon, Apr 27, 2020 at 2:27 PM dunbarx--- via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> Hi.
>> You are getting empty because the information returned from the function
>> is an array.
>> "combine " the array with "return and "comma"
>> Craig
>>
>>
>> -Original Message-
>> From: Skip Kimpel via use-livecode 
>> To: Dan Friedman 
>> Cc: Skip Kimpel ; How to use LiveCode <
>> use-livecode@lists.runrev.com>
>> Sent: Mon, Apr 27, 2020 1:52 pm
>> Subject: Re: Counting unique items in a file
>>
>> Thanks Dan!
>>
>> Upon very quick implementation, I am getting empty results back.  I think
>> I
>> need to play around with this a little bit more but I feel you got me on
>> the right track.
>>
>> Thanks again,
>>
>> SKIP
>>
>> On Mon, Apr 27, 2020 at 1:34 PM Dan Friedman 
>> wrote:
>>
>> > Skip,
>> >
>> > Haven't tested, but pope about this...
>> >
>> > function getUniqueNames inData,pColumn
>> >  put "" into uNames
>> >  set the itemDel to tab
>> >  repeat for each line l in inData
>> >add 1 to uNames[item pColumn of l]
>> >  end repeat
>> >
>> >  return uNames
>> > end getUniqueNames
>> >
>> > You should get back an array keyed by the unique names, and how many
>> > instances of each one
>> >
>> >
>> > -Dan
>> >
>> >
>> >
>> > On 4/27/20, 10:25 AM, "use-livecode on behalf of Skip Kimpel via
>> > use-livecode" > > use-livecode@lists.runrev.com> wrote:
>> >
>> >Good afternoon LC'ers,
>> >
>> >I am loading a tab delimited file into a variable and I need to pull
>> > out
>> >all unique names from a certain column (let's say column 10) and
>> count
>> > how
>> >many times that name appears in that column.
>> >
>> >I know there has to be an easy way of doing it.  Every time I try to
>> > start
>> >coding this it get wyyy too long :)
>> >
>> >Simple approach?
>> >
>> >SKIP
>> >___
>> >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
>> ___
>> 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: Counting unique items in a file

2020-04-27 Thread Skip Kimpel via use-livecode
Silly me... of course.  Thank you, Dunbarx for pointing out the obvious :)

SKIP

On Mon, Apr 27, 2020 at 2:27 PM dunbarx--- via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi.
> You are getting empty because the information returned from the function
> is an array.
> "combine " the array with "return and "comma"
> Craig
>
>
> -Original Message-
> From: Skip Kimpel via use-livecode 
> To: Dan Friedman 
> Cc: Skip Kimpel ; How to use LiveCode <
> use-livecode@lists.runrev.com>
> Sent: Mon, Apr 27, 2020 1:52 pm
> Subject: Re: Counting unique items in a file
>
> Thanks Dan!
>
> Upon very quick implementation, I am getting empty results back.  I think I
> need to play around with this a little bit more but I feel you got me on
> the right track.
>
> Thanks again,
>
> SKIP
>
> On Mon, Apr 27, 2020 at 1:34 PM Dan Friedman 
> wrote:
>
> > Skip,
> >
> > Haven't tested, but pope about this...
> >
> > function getUniqueNames inData,pColumn
> >  put "" into uNames
> >  set the itemDel to tab
> >  repeat for each line l in inData
> >add 1 to uNames[item pColumn of l]
> >  end repeat
> >
> >  return uNames
> > end getUniqueNames
> >
> > You should get back an array keyed by the unique names, and how many
> > instances of each one
> >
> >
> > -Dan
> >
> >
> >
> > On 4/27/20, 10:25 AM, "use-livecode on behalf of Skip Kimpel via
> > use-livecode"  > use-livecode@lists.runrev.com> wrote:
> >
> >Good afternoon LC'ers,
> >
> >I am loading a tab delimited file into a variable and I need to pull
> > out
> >all unique names from a certain column (let's say column 10) and count
> > how
> >many times that name appears in that column.
> >
> >I know there has to be an easy way of doing it.  Every time I try to
> > start
> >coding this it get wyyy too long :)
> >
> >Simple approach?
> >
> >SKIP
> >___
> >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
> ___
> 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: Counting unique items in a file

2020-04-27 Thread dunbarx--- via use-livecode
Hi.
You are getting empty because the information returned from the function is an 
array.
"combine " the array with "return and "comma"
Craig


-Original Message-
From: Skip Kimpel via use-livecode 
To: Dan Friedman 
Cc: Skip Kimpel ; How to use LiveCode 

Sent: Mon, Apr 27, 2020 1:52 pm
Subject: Re: Counting unique items in a file

Thanks Dan!

Upon very quick implementation, I am getting empty results back.  I think I
need to play around with this a little bit more but I feel you got me on
the right track.

Thanks again,

SKIP

On Mon, Apr 27, 2020 at 1:34 PM Dan Friedman 
wrote:

> Skip,
>
> Haven't tested, but pope about this...
>
> function getUniqueNames inData,pColumn
>  put "" into uNames
>  set the itemDel to tab
>  repeat for each line l in inData
>    add 1 to uNames[item pColumn of l]
>  end repeat
>
>  return uNames
> end getUniqueNames
>
> You should get back an array keyed by the unique names, and how many
> instances of each one
>
>
> -Dan
>
>
>
> On 4/27/20, 10:25 AM, "use-livecode on behalf of Skip Kimpel via
> use-livecode"  use-livecode@lists.runrev.com> wrote:
>
>    Good afternoon LC'ers,
>
>    I am loading a tab delimited file into a variable and I need to pull
> out
>    all unique names from a certain column (let's say column 10) and count
> how
>    many times that name appears in that column.
>
>    I know there has to be an easy way of doing it.  Every time I try to
> start
>    coding this it get wyyy too long :)
>
>    Simple approach?
>
>    SKIP
>    ___
>    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
___
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: Counting unique items in a file

2020-04-27 Thread Skip Kimpel via use-livecode
Thanks Dan!

Upon very quick implementation, I am getting empty results back.  I think I
need to play around with this a little bit more but I feel you got me on
the right track.

Thanks again,

SKIP

On Mon, Apr 27, 2020 at 1:34 PM Dan Friedman 
wrote:

> Skip,
>
> Haven't tested, but pope about this...
>
> function getUniqueNames inData,pColumn
>   put "" into uNames
>   set the itemDel to tab
>   repeat for each line l in inData
> add 1 to uNames[item pColumn of l]
>   end repeat
>
>   return uNames
> end getUniqueNames
>
> You should get back an array keyed by the unique names, and how many
> instances of each one
>
>
> -Dan
>
>
>
> On 4/27/20, 10:25 AM, "use-livecode on behalf of Skip Kimpel via
> use-livecode"  use-livecode@lists.runrev.com> wrote:
>
> Good afternoon LC'ers,
>
> I am loading a tab delimited file into a variable and I need to pull
> out
> all unique names from a certain column (let's say column 10) and count
> how
> many times that name appears in that column.
>
> I know there has to be an easy way of doing it.  Every time I try to
> start
> coding this it get wyyy too long :)
>
> Simple approach?
>
> SKIP
> ___
> 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: Counting unique items in a file

2020-04-27 Thread Dan Friedman via use-livecode
Skip,

Haven't tested, but pope about this...

function getUniqueNames inData,pColumn
  put "" into uNames
  set the itemDel to tab
  repeat for each line l in inData
add 1 to uNames[item pColumn of l]
  end repeat
  
  return uNames
end getUniqueNames

You should get back an array keyed by the unique names, and how many instances 
of each one


-Dan



On 4/27/20, 10:25 AM, "use-livecode on behalf of Skip Kimpel via use-livecode" 
 wrote:

Good afternoon LC'ers,

I am loading a tab delimited file into a variable and I need to pull out
all unique names from a certain column (let's say column 10) and count how
many times that name appears in that column.

I know there has to be an easy way of doing it.  Every time I try to start
coding this it get wyyy too long :)

Simple approach?

SKIP
___
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