Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Everyone's head is a cheap movie show." -- Jeff G. Bone


devel / comp.lang.mumps / Re: Querying data in MUMPS

SubjectAuthor
* Querying data in MUMPSKM
+- Re: Querying data in MUMPSValeriu Gontia
`* Re: Querying data in MUMPSValeriu Gontia
 `* Re: Querying data in MUMPSed de moel
  +- Re: Querying data in MUMPSOldMster
  +* Re: Querying data in MUMPSOldMster
  |`* Re: Querying data in MUMPSJens
  | +- Re: Querying data in MUMPSLouis
  | `- Re: Querying data in MUMPSKM
  `- Re: Querying data in MUMPSRod Dorman

1
Querying data in MUMPS

<3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=278&group=comp.lang.mumps#278

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a05:6214:29c3:: with SMTP id gh3mr445610qvb.44.1639700114449;
Thu, 16 Dec 2021 16:15:14 -0800 (PST)
X-Received: by 2002:ac8:58ca:: with SMTP id u10mr452434qta.44.1639700114333;
Thu, 16 Dec 2021 16:15:14 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Thu, 16 Dec 2021 16:15:14 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2601:14d:8081:62a0:6dd4:d198:c7e:f995;
posting-account=J3vr1goAAAAjAXQQdsRhyS_8VdbLGYUS
NNTP-Posting-Host: 2601:14d:8081:62a0:6dd4:d198:c7e:f995
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
Subject: Querying data in MUMPS
From: kifm@protonmail.com (KM)
Injection-Date: Fri, 17 Dec 2021 00:15:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 26
 by: KM - Fri, 17 Dec 2021 00:15 UTC

Hi all,

Novice MUMPer here. I am trying to query a large dataset using M and was wondering how to efficiently query a global.

For example, how does one filter for 10,000 of the most recent records (by Unix Time) which have a pattern of ^table(*,"A","C")? For a small list size, one could write some kind of $data/$order counting loop, but is that really the most efficient way to query something like this?

^table(1639615761233,"A","B")=1
^table(1639615761499,"A","C")=1
^table(1639615761761,"A","D")=0
^table(1639615762029,"A","E")=1
^table(1639615762298,"A","F")=1
^table(1639615762696,"A","G")=0
^table(1639615763508,"B","C")=0
^table(1639615763821,"B","D")=0
^table(1639615764099,"B","E")=0
^table(1639615764380,"B","F")=1
^table(1639615764640,"B","G")=1
^table(1639615768122,"D","C")=0
^table(1639615769781,"D","F")=1
^table(1639616032012,"A","B")=0
^table(1639616032294,"A","C")=0
^table(1639616032565,"A","D")=1
(...)

Re: Querying data in MUMPS

<6faff63b-d4b6-4dd7-971b-d5a284b2a4b9n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=279&group=comp.lang.mumps#279

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a05:6214:2aad:: with SMTP id js13mr1115780qvb.61.1639725916956;
Thu, 16 Dec 2021 23:25:16 -0800 (PST)
X-Received: by 2002:a05:6214:5193:: with SMTP id kl19mr1413065qvb.69.1639725916774;
Thu, 16 Dec 2021 23:25:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Thu, 16 Dec 2021 23:25:16 -0800 (PST)
In-Reply-To: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=89.28.53.26; posting-account=6oXPhQoAAAA5df4ZzTru9drXwPkbOifd
NNTP-Posting-Host: 89.28.53.26
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6faff63b-d4b6-4dd7-971b-d5a284b2a4b9n@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: gontiaval@gmail.com (Valeriu Gontia)
Injection-Date: Fri, 17 Dec 2021 07:25:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 41
 by: Valeriu Gontia - Fri, 17 Dec 2021 07:25 UTC

пятница, 17 декабря 2021 г. в 02:15:14 UTC+2, KM:
> Hi all,
>
> Novice MUMPer here. I am trying to query a large dataset using M and was wondering how to efficiently query a global.
>
> For example, how does one filter for 10,000 of the most recent records (by Unix Time) which have a pattern of ^table(*,"A","C")? For a small list size, one could write some kind of $data/$order counting loop, but is that really the most efficient way to query something like this?
>
> ^table(1639615761233,"A","B")=1
> ^table(1639615761499,"A","C")=1
> ^table(1639615761761,"A","D")=0
> ^table(1639615762029,"A","E")=1
> ^table(1639615762298,"A","F")=1
> ^table(1639615762696,"A","G")=0
> ^table(1639615763508,"B","C")=0
> ^table(1639615763821,"B","D")=0
> ^table(1639615764099,"B","E")=0
> ^table(1639615764380,"B","F")=1
> ^table(1639615764640,"B","G")=1
> ^table(1639615768122,"D","C")=0
> ^table(1639615769781,"D","F")=1
> ^table(1639616032012,"A","B")=0
> ^table(1639616032294,"A","C")=0
> ^table(1639616032565,"A","D")=1
> (...)

You can do something like this:

s (date,var1,var2)="",interval1="16396160....",interval2="16396161...." ; Your time intervals !!!
f s date=$o(^table(date)) q:date="" d
. f s var1=$o(^table(date,var1)) q:var1="" d
. . f s var2=$o(^table(date,var1,var2)) q:var2="" d
. . . i (interval1'="")&(interval2'="")&(date'<interval1)&(date'>interval2) d
. . . . s steps="Your next steps: ="_date
.. . . . w steps,!
..................

Re: Querying data in MUMPS

<d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=280&group=comp.lang.mumps#280

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a37:a956:: with SMTP id s83mr1160642qke.500.1639735889350;
Fri, 17 Dec 2021 02:11:29 -0800 (PST)
X-Received: by 2002:ac8:59d4:: with SMTP id f20mr1581717qtf.241.1639735889186;
Fri, 17 Dec 2021 02:11:29 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Fri, 17 Dec 2021 02:11:29 -0800 (PST)
In-Reply-To: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=89.28.53.26; posting-account=6oXPhQoAAAA5df4ZzTru9drXwPkbOifd
NNTP-Posting-Host: 89.28.53.26
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: gontiaval@gmail.com (Valeriu Gontia)
Injection-Date: Fri, 17 Dec 2021 10:11:29 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 38
 by: Valeriu Gontia - Fri, 17 Dec 2021 10:11 UTC

пятница, 17 декабря 2021 г. в 02:15:14 UTC+2, KM:
> Hi all,
>
> Novice MUMPer here. I am trying to query a large dataset using M and was wondering how to efficiently query a global.
>
> For example, how does one filter for 10,000 of the most recent records (by Unix Time) which have a pattern of ^table(*,"A","C")? For a small list size, one could write some kind of $data/$order counting loop, but is that really the most efficient way to query something like this?
>
> ^table(1639615761233,"A","B")=1
> ^table(1639615761499,"A","C")=1
> ^table(1639615761761,"A","D")=0
> ^table(1639615762029,"A","E")=1
> ^table(1639615762298,"A","F")=1
> ^table(1639615762696,"A","G")=0
> ^table(1639615763508,"B","C")=0
> ^table(1639615763821,"B","D")=0
> ^table(1639615764099,"B","E")=0
> ^table(1639615764380,"B","F")=1
> ^table(1639615764640,"B","G")=1
> ^table(1639615768122,"D","C")=0
> ^table(1639615769781,"D","F")=1
> ^table(1639616032012,"A","B")=0
> ^table(1639616032294,"A","C")=0
> ^table(1639616032565,"A","D")=1
> (...)
you can $order -1 and use the counter to read the last 10,000 records ...

s (date,var1,var2,cik)=""
f s date=$o(^table(date,-1)) q:date="" d
. f s var1=$o(^table(date,var1,-1)) q:var1="" d
. . f s var2=$o(^table(date,var1,var2,-1)) q:var2="" d
. . . s cik=cik+1 q:cik=10000 d
. . . . s steps="Your data: ="_date
. . . . w steps,!

Re: Querying data in MUMPS

<ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=281&group=comp.lang.mumps#281

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a05:620a:404e:: with SMTP id i14mr2278707qko.111.1639759474833;
Fri, 17 Dec 2021 08:44:34 -0800 (PST)
X-Received: by 2002:ae9:eb45:: with SMTP id b66mr2169036qkg.695.1639759474686;
Fri, 17 Dec 2021 08:44:34 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Fri, 17 Dec 2021 08:44:34 -0800 (PST)
In-Reply-To: <d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=71.174.62.16; posting-account=j7lJmQoAAADTx0Apfk15DZ7D0qlYy4zv
NNTP-Posting-Host: 71.174.62.16
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com> <d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: eddemoel@gmail.com (ed de moel)
Injection-Date: Fri, 17 Dec 2021 16:44:34 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 10
 by: ed de moel - Fri, 17 Dec 2021 16:44 UTC

To me, the most straightforward approach seems to be something like:

Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
. Set reference=$Query(@reference,-1) Quit:reference=""
. Quit:reference'["""A"",""C"")"
. Set count=count+1,result(reference)=1
. Quit
Quit

(please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit commands)

Re: Querying data in MUMPS

<2a7990f3-9485-4054-879a-3db9fe18d3c4n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=283&group=comp.lang.mumps#283

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a05:620a:2596:: with SMTP id x22mr3189873qko.408.1639778576782;
Fri, 17 Dec 2021 14:02:56 -0800 (PST)
X-Received: by 2002:a05:620a:4096:: with SMTP id f22mr3291993qko.600.1639778576578;
Fri, 17 Dec 2021 14:02:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Fri, 17 Dec 2021 14:02:56 -0800 (PST)
In-Reply-To: <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=50.249.135.41; posting-account=B5cu_goAAACZo0vIvp9ba07OhA0t6wHW
NNTP-Posting-Host: 50.249.135.41
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
<d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com> <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2a7990f3-9485-4054-879a-3db9fe18d3c4n@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: sires.mark@gmail.com (OldMster)
Injection-Date: Fri, 17 Dec 2021 22:02:56 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 10
 by: OldMster - Fri, 17 Dec 2021 22:02 UTC

On Friday, December 17, 2021 at 11:44:35 AM UTC-5, ed de moel wrote:
> To me, the most straightforward approach seems to be something like:
>
> Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
> . Set reference=$Query(@reference,-1) Quit:reference=""
> . Quit:reference'["""A"",""C"")"
> . Set count=count+1,result(reference)=1
> . Quit
> Quit
>
> (please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit com

Re: Querying data in MUMPS

<49fcd501-9cfa-4b91-8b75-cea3fb447b4dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=284&group=comp.lang.mumps#284

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a0c:fec6:: with SMTP id z6mr4444929qvs.40.1639778615261;
Fri, 17 Dec 2021 14:03:35 -0800 (PST)
X-Received: by 2002:a05:6214:301b:: with SMTP id ke27mr4601630qvb.68.1639778615116;
Fri, 17 Dec 2021 14:03:35 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Fri, 17 Dec 2021 14:03:34 -0800 (PST)
In-Reply-To: <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=50.249.135.41; posting-account=B5cu_goAAACZo0vIvp9ba07OhA0t6wHW
NNTP-Posting-Host: 50.249.135.41
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
<d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com> <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <49fcd501-9cfa-4b91-8b75-cea3fb447b4dn@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: sires.mark@gmail.com (OldMster)
Injection-Date: Fri, 17 Dec 2021 22:03:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: OldMster - Fri, 17 Dec 2021 22:03 UTC

On Friday, December 17, 2021 at 11:44:35 AM UTC-5, ed de moel wrote:
> To me, the most straightforward approach seems to be something like:
>
> Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
> . Set reference=$Query(@reference,-1) Quit:reference=""
> . Quit:reference'["""A"",""C"")"
> . Set count=count+1,result(reference)=1
> . Quit
> Quit
>
> (please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit commands)
Ed wins! :-) I was putting together the same method, but he beat me to it.

Re: Querying data in MUMPS

<a6c030d1-a707-4c03-8561-fbc50b49b6abn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=285&group=comp.lang.mumps#285

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a05:622a:453:: with SMTP id o19mr1613115qtx.648.1639780503417;
Fri, 17 Dec 2021 14:35:03 -0800 (PST)
X-Received: by 2002:a05:622a:1789:: with SMTP id s9mr4554651qtk.604.1639780503194;
Fri, 17 Dec 2021 14:35:03 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Fri, 17 Dec 2021 14:35:03 -0800 (PST)
In-Reply-To: <49fcd501-9cfa-4b91-8b75-cea3fb447b4dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:d5:e70d:900:143:7fa0:b01d:645;
posting-account=Fb5loAoAAAAWGHFa1kwW5TIlX7XcPFIS
NNTP-Posting-Host: 2003:d5:e70d:900:143:7fa0:b01d:645
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
<d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com> <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
<49fcd501-9cfa-4b91-8b75-cea3fb447b4dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a6c030d1-a707-4c03-8561-fbc50b49b6abn@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: jewu34@web.de (Jens)
Injection-Date: Fri, 17 Dec 2021 22:35:03 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 21
 by: Jens - Fri, 17 Dec 2021 22:35 UTC

OldMster schrieb am Freitag, 17. Dezember 2021 um 23:03:35 UTC+1:
> On Friday, December 17, 2021 at 11:44:35 AM UTC-5, ed de moel wrote:
> > To me, the most straightforward approach seems to be something like:
> >
> > Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
> > . Set reference=$Query(@reference,-1) Quit:reference=""
> > . Quit:reference'["""A"",""C"")"
> > . Set count=count+1,result(reference)=1
> > . Quit
> > Quit
> >
> > (please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit commands)
> Ed wins! :-) I was putting together the same method, but he beat me to it.

I don't agree.
I'd code:
S count=0,time="" F S time=$O(^table(time),-1) Q:time=""!(count>9999) D
.I $D(^table(time,"A","C")) W time,^table(time,"A","C"),! S count=count+1
Q

Or do I overlook something?

Re: Querying data in MUMPS

<5baa6de7-8d12-46b5-961a-732320fc9a95n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=286&group=comp.lang.mumps#286

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a0c:8e08:: with SMTP id v8mr7016818qvb.93.1639848879157;
Sat, 18 Dec 2021 09:34:39 -0800 (PST)
X-Received: by 2002:a05:6214:2626:: with SMTP id gv6mr6956201qvb.29.1639848879010;
Sat, 18 Dec 2021 09:34:39 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Sat, 18 Dec 2021 09:34:38 -0800 (PST)
In-Reply-To: <a6c030d1-a707-4c03-8561-fbc50b49b6abn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:14d:8081:62a0:d996:a588:7960:b7c;
posting-account=Bx6t8QoAAADidOELeN9OBl87iiynpVyy
NNTP-Posting-Host: 2601:14d:8081:62a0:d996:a588:7960:b7c
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
<d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com> <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
<49fcd501-9cfa-4b91-8b75-cea3fb447b4dn@googlegroups.com> <a6c030d1-a707-4c03-8561-fbc50b49b6abn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5baa6de7-8d12-46b5-961a-732320fc9a95n@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: louis.huang@hotmail.com (Louis)
Injection-Date: Sat, 18 Dec 2021 17:34:39 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 27
 by: Louis - Sat, 18 Dec 2021 17:34 UTC

On Friday, December 17, 2021 at 5:35:03 PM UTC-5, Jens wrote:
> OldMster schrieb am Freitag, 17. Dezember 2021 um 23:03:35 UTC+1:
> > On Friday, December 17, 2021 at 11:44:35 AM UTC-5, ed de moel wrote:
> > > To me, the most straightforward approach seems to be something like:
> > >
> > > Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
> > > . Set reference=$Query(@reference,-1) Quit:reference=""
> > > . Quit:reference'["""A"",""C"")"
> > > . Set count=count+1,result(reference)=1
> > > . Quit
> > > Quit
> > >
> > > (please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit commands)
> > Ed wins! :-) I was putting together the same method, but he beat me to it.
> I don't agree.
> I'd code:
> S count=0,time="" F S time=$O(^table(time),-1) Q:time=""!(count>9999) D
> .I $D(^table(time,"A","C")) W time,^table(time,"A","C"),! S count=count+1
> Q
>
> Or do I overlook something?

Thank you for the responses. I will look into the query examples given.

Being so use to SQL syntax, I would have thought loops would be a inefficient way to do querying such as this. I guess as long as one writes well using loops the O(n) factor may be managed.

Gratitude,
KM

Re: Querying data in MUMPS

<ca34d2a7-1bb4-4f0c-9fdb-67ee14cc5a9bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=287&group=comp.lang.mumps#287

  copy link   Newsgroups: comp.lang.mumps
X-Received: by 2002:a05:622a:2d5:: with SMTP id a21mr1713202qtx.56.1639849155946;
Sat, 18 Dec 2021 09:39:15 -0800 (PST)
X-Received: by 2002:ae9:eb45:: with SMTP id b66mr4977471qkg.695.1639849155806;
Sat, 18 Dec 2021 09:39:15 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.mumps
Date: Sat, 18 Dec 2021 09:39:15 -0800 (PST)
In-Reply-To: <a6c030d1-a707-4c03-8561-fbc50b49b6abn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:14d:8081:62a0:d996:a588:7960:b7c;
posting-account=J3vr1goAAAAjAXQQdsRhyS_8VdbLGYUS
NNTP-Posting-Host: 2601:14d:8081:62a0:d996:a588:7960:b7c
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com>
<d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com> <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
<49fcd501-9cfa-4b91-8b75-cea3fb447b4dn@googlegroups.com> <a6c030d1-a707-4c03-8561-fbc50b49b6abn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca34d2a7-1bb4-4f0c-9fdb-67ee14cc5a9bn@googlegroups.com>
Subject: Re: Querying data in MUMPS
From: kifm@protonmail.com (KM)
Injection-Date: Sat, 18 Dec 2021 17:39:15 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 27
 by: KM - Sat, 18 Dec 2021 17:39 UTC

On Friday, December 17, 2021 at 5:35:03 PM UTC-5, Jens wrote:
> OldMster schrieb am Freitag, 17. Dezember 2021 um 23:03:35 UTC+1:
> > On Friday, December 17, 2021 at 11:44:35 AM UTC-5, ed de moel wrote:
> > > To me, the most straightforward approach seems to be something like:
> > >
> > > Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
> > > . Set reference=$Query(@reference,-1) Quit:reference=""
> > > . Quit:reference'["""A"",""C"")"
> > > . Set count=count+1,result(reference)=1
> > > . Quit
> > > Quit
> > >
> > > (please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit commands)
> > Ed wins! :-) I was putting together the same method, but he beat me to it.
> I don't agree.
> I'd code:
> S count=0,time="" F S time=$O(^table(time),-1) Q:time=""!(count>9999) D
> .I $D(^table(time,"A","C")) W time,^table(time,"A","C"),! S count=count+1
> Q
>
> Or do I overlook something?

Thank you for the responses. I will look into the query examples given.

Being so use to SQL syntax, I would have thought loops would be a inefficient way to do querying such as this. I guess as long as one writes well using loops the O(n) factor may be managed.

Gratitude,
KM

Re: Querying data in MUMPS

<spp17l$rq1$1@reader1.panix.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=288&group=comp.lang.mumps#288

  copy link   Newsgroups: comp.lang.mumps
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.panix2.panix.com!not-for-mail
From: rodd@panix.com (Rod Dorman)
Newsgroups: comp.lang.mumps
Subject: Re: Querying data in MUMPS
Date: Mon, 20 Dec 2021 04:36:05 -0000 (UTC)
Organization: Public Access Networks Corp.
Message-ID: <spp17l$rq1$1@reader1.panix.com>
References: <3eca7363-f102-424e-af2b-1ba9e40917d0n@googlegroups.com> <d00cf646-ad26-4eff-ae62-5d54f19c8119n@googlegroups.com> <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>
Injection-Date: Mon, 20 Dec 2021 04:36:05 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="panix2.panix.com:166.84.1.2";
logging-data="28481"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
 by: Rod Dorman - Mon, 20 Dec 2021 04:36 UTC

In article <ec592130-7d33-4d67-843e-0b3b3cd15dc8n@googlegroups.com>,
ed de moel <eddemoel@gmail.com> wrote:
>To me, the most straightforward approach seems to be something like:
>
> Set max=10000,count=0,reference="^table" For Do Quit:reference="" Quit:count'<max
> . Set reference=$Query(@reference,-1) Quit:reference=""
> . Quit:reference'["""A"",""C"")"
> . Set count=count+1,result(reference)=1
> . Quit
> Quit
>
>(please note that this medium compresses double spaces to single ones, so there should be 2 spaces following the For, Do and Quit commands)

Shouldn't you also check that $QL(reference)=3

--
-- Rod --
rodd(at)polylogics(dot)com

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor