查找

问题
· 五月 16, 2022

How to distinguish whether a variable is a pure numeric string or a number, such as "123" and "123".

HI Guys.

I want to know how to distinguish whether a variable is a pure numeric string or a number, such as "123" and "123".

I only know an inelegant way.

ClassMethod IsNumber(n)
{
	s ret=0
	try{
		s ret= $lb(n)=$lb(+n)
	}catch e{
		s ret=0
	}
	q ret
}

Is there any other way to implement it

13 Comments
讨论 (13)2
登录或注册以继续
文章
· 五月 14, 2022 阅读大约需 8 分钟

M:N in Contest #2

Implementation

  • B is the Winner Table: It holds the region and a numeric as ID. Short name is left empty for privacy protection in this Demo
  • A is the table of all contests with dates
  • X,C  are the arrays of prizes. They are projected as SQL tables.   When assigned they refer to 1 winner

User guide

Start the demo in Docker from IRIS console or in Webterminal

USER>do ##class(dc.rcc.Main).Menue()

You jump on top of fresh page

Welcome to OEX Contest Statistics

Select Contests, Prizes, Winners, Assign, Statistics, eXit (C,P,W,A,S,X) :

Contests, Prizes, Winners  have the same maintenance functions and show the
data status before and after processing.

Contest List, Edit, New, Delete, eXit (L,E,N,D,X) :
Prizes List, Edit, New, Delete, eXit (L,E,N,D,X) :
Winners List, Edit, New, Delete, eXit (L,E,N,D,X) :

List, Edit, Delete ask for additional IDs of the records processed.
A typical EDIT sequence for the actual Contest:

Select Contests, Prizes, Winners, Assign, Statistics, eXit (C,P,W,A,S,X) :c

Contest List, Edit, New, Delete, eXit (L,E,N,D,X) :e

Contest ID :24
ID      Start_Date      End_Date        Title
24      2022-05-09      2022-05-29      InterSystems Grand Prix 2022

1 Rows(s) Affected

Change Start_Date (ODBC Format)[2022-05-09] :

Change End_Date (ODBC Format)[2022-05-29] :

Change Title [InterSystems Grand Prix 2022] :

ID      Start_Date      End_Date        Title
24      2022-05-09      2022-05-29      InterSystems Grand Prix 2022

1 Rows(s) Affected

Assign also allows Remove or (implicitly) Overload assignment of a prize.

Select Contests, Prizes, Winners, Assign, Statistics, eXit (C,P,W,A,S,X) :A
Assign or Remove Winner (A,R) :a
Winner's region (as,br,eu,ru,us) :us
ID      Region  RegID   Short
us||1   us      1       ?
us||2   us      2       ?
us||3   us      3       ?
us||4   us      4       ?

4 Rows(s) Affected
Winner's RegID :4
Contest ID :5
ID      Cat     Rank    Value   WinrID  Short   Title
5       C       1       1000    br||1   ?      InterSystems IRIS for Health FHIR
5       C       2       500     br||2   ?      InterSystems IRIS for Health FHIR
5       X       1       1500    br||1   ?      InterSystems IRIS for Health FHIR
5       X       2       1500    br||2   ?      InterSystems IRIS for Health FHIR
5       X       3       500     br||5   ?      InterSystems IRIS for Health FHIR

5 Rows(s) Affected
Category (C,X) :c Rank :1
ID      Cat     Rank    Value   WinrID  Short   Title
5       C       1       1000    br||1   ?      InterSystems IRIS for Health FHIR

1 Rows(s) Affected
Assign Winner us||4 (Y,N) [N]:y
ID      Cat     Rank    Value   WinrID  Short   Title
5       C       1       1000    us||4   ?      InterSystems IRIS for Health FHIR

1 Rows(s) Affected
Contest ID :

Statistics is a collection of pre-composed queries.
You can always select the Category displayed:  (C=Community, X=eXperts, *=All)
 
In order to inspire you for your own queries, you can also display the SQL statement used.

Select Contests, Prizes, Winners, Assign, Statistics, eXit (C,P,W,A,S,X) :s

Prepared Statistics
 1 - Total prizes by contest
 2 - Total prizes by region
 3 - Total prizes by winners
 4 - Winner's ranking in contest
 5 - Winner's Profile
 X - eXit
  Select statistic [X]:2
Category (C=Community,X=eXperts,*=All) :*

Cat     Prizes  Value   Region
  *      88     68170   br
  *      40     42425   ru
  *      27     19700   eu
  *      13     15825   as
  *       8     9000    us

5 Rows(s) Affected
     Show SQL Statement (YN) [N] :y

     SELECT LPAD(cat,3) Cat, LPAD(count(*),3) Prizes, Sum(val) Value, Region
      FROM ( SELECT '*' Cat,
     C_value val, C_winner->Region FROM dc_rcc.Contest_C
      UNION ALL SELECT '*' Cat,
     X_value val, X_Winner->Region FROM dc_rcc.Contest_X
      ) WHERE val>1 AND NOT Region IS NULL
      GROUP BY Region ORDER BY 3 DESC

or

Prepared Statistics
 1 - Total prizes by contest
 2 - Total prizes by region
 3 - Total prizes by winners
 4 - Winner's ranking in contest
 5 - Winner's Profile
 X - eXit
  Select statistic [X]:5
Category (C=Community,X=eXperts,*=All) :c

Cat     Contest Best    Winner  Value   ConCnt  ContestList - - - - - - - - - - - - - -         RankList
  C       1     1       ru||1   4750      7     1,11,13,16,21,22,23                             1,3,3,1,3,1,1
  C       1     1       br||4   1770      5     1,2,15,18,19                                    2,2,1,3,1
  C       2     1       br||1   7250     11     2,5,6,7,9,10,12,13,14,17,18                     1,1,1,2,1,2,2,1,2,2,2
  C       3     1       br||5   1750      3     3,4,14                                          2,1,4
  C       3     1       eu||3   1000      1     3                                               1
  C       4     1       br||2   4500     10     4,5,9,10,12,13,14,18,21,23                      2,2,2,3,3,2,1,1,1,2
  C       4     1       br||3   2950      6     4,7,9,17,18,19                                  3,1,3,1,4,2
  C       6     2       ru||2   1075      3     6,19,22                                         2,3,2
  C       6     3       ru||8   250       1     6                                               3
  C       7     3       eu||1   750       3     7,12,17                                         3,4,3
  C      10     1       as||2   4000      2     10,11                                           1,1
  C      11     2       as||3   1500      1     11                                              2
  C      12     1       eu||2   750       1     12                                              1
  C      13     4       br||6   250       1     13                                              4
  C      14     3       ru||5   500       1     14                                              3
  C      16     2       as||5   500       1     16                                              2
  C      16     3       ru||3   250       1     16                                              3
  C      21     2       as||1   1000      2     21,23                                           2,3
  C      22     3       as||4   625       1     22                                              3

19 Rows(s) Affected
     Show SQL Statement (YN) [N] :

Happy testing.

GitHub
Demo Video

Demo Server SMP
Demo Server WebTerminal

讨论 (0)2
登录或注册以继续
文章
· 五月 14, 2022 阅读大约需 2 分钟

M:N in Contest #1

M:N Relationship is a recurring object of my interest for a long time.
So the subject turns up with me repeatedly.
For this article, I found a nice example with TWO  separate M:N relationships. Some M:N².

 

It is not pure fiction but taken from a closer view of OEX Contests that we run on a regular base.


Short summary of the demo case: 

  • Up to now, we have seen 23 International Contests, #24 is just running
  • We have seen 183 prizes assigned + 23 new ones in the actual contest
  • The prizes are split into categories eXperts and Community
  • These prizes are actually distributed to 35 Winners that I grouped into 5 regions

I think this is a nice subject to be investigated in IRIS.
And the numbers are small enough to follow easily.

Technology:

  • It is all organized in standard object Classes / Tables 
  • The whole interface is written in Object Script as CHUI (no Py, Java, Angular, ...)     - not to distract from essential concept  by fancy graphic
  • You see maintenance for Contests, Prizes, WInners, Assignments
  • For Statistics display of the generated SQL Queries is an option.

Detailed handling is part of the 2nd article related to the package.
Just follow the link and watch the Video.

Disclaimer:

In the demo, all Personal Names have been anonymized for personal data protection.
Information on contest dates and prizes are from public available OEX pages.
The grouping of winners in regions is my personal approximation.

Sneek Previews: 

Total Prizes by Region 

Winner's Profile (Shortened)

And of course,   there is just no limit to your own creativity

Version 0.0.2 improved statistic #5



Demo Video

2 Comments
讨论 (2)2
登录或注册以继续
文章
· 五月 6, 2022 阅读大约需 1 分钟

最大ネームスペース数とデータベース数

これは、InterSystems FAQ サイト の記事です。

1つのインスタンスで作成可能なネームスペース数の上限は、2048個になります。

ただし多数のネームスペースを使用するには、それに合わせてメモリの設定が必要になります。使用するメモリの設定については下記の関連トピックご参照ください。
管理ポータルのメモリ関連設定項目について

また1つのインスタンスに作成可能なデータベース数(リモートデータベースを含む)の上限は、15998個になります。
なおライセンスの種類によっては、作成可能な数に制限が設けられています。 

詳細については、以下ドキュメントをご参照ください。
ドキュメント:ネームスペースの構成
ドキュメント:ローカル・データベースの構成
 

讨论 (0)1
登录或注册以继续
讨论
· 五月 5, 2022

Should the "Resource" for a local Database be stored centrally or with the DAT file?

I am sure I came across this in the past with Cache and just saw this again in IRIS.

When rebuilding or swapping a DAT file for a database it retains the Resource of the DAT file, not the Resource of the Database it is being used for.

For instance, if I have a local Database called APP with a resource %DB_APP and I want to refresh the data from another Database called TEST that has a Resource %DB_TEST I can just copy the DAT file from the TEST folder to the APP folder.

No Database settings are changed and it is all done with either IRIS down or the databases dismounted.

If you now look at the Database settings for the APP database it has the %DB_TEST resource not the %DB_APP it had before.

This is not necessarily a common occurrence and can obviously be handled but it something that can catch people out and not initially noticed.

What is peoples preference, should it keep the Resource for the Database settings or the DAT files?

For me, personally, I would prefer to keep the settings separate from the DAT file.

5 Comments
讨论 (5)0
登录或注册以继续