検索

記事
· 2022年5月27日 1m read

WebCommand

There is a popular package "WebTerminal". It is excellent in most situations.
Except:

  • running system commands in your operating shell is not so easy
  • as it communicates to the IRIS host over HTTP and WSS it consumes 2 connections
    • With only 5 connections in the community license (and the "Grace Period of CSP")
    • you can hit the limits rater fast: 2 Webterminals + 1 SMP and you are done
  • WebCommand is a pure CSP page consuming just 1 single connection
  • WebCommand allows multiple ObjectScript command lines running in sequence
  • With $ or ! your command goes to Operating System same as with default terminal
  • It is no full terminal emulation but a slim helper for debugging
  • And it is an excellent place to apply "One Liners"

Just a simple loop in ObjectScript

Directory listing inside container

File Dump

 

Demo Server SMP
Demo Server WebCommand

GitHub

Code Quality

1 Comment
ディスカッション (1)1
続けるにはログインするか新規登録を行ってください
記事
· 2022年5月25日 2m read

設定されているネームスペース一覧をプログラムで取得する方法

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

%SYS.Namespace クラスの List クエリで取得することができます。

次のようなルーチンを作成し、ターミナルで実行してください。


1. サンプルの作成

getnsp
   // ネームスペース一覧を取得する write "nsp:glo:rtn",!,!
   set statement=##class(%SQL.Statement).%New()
   set status=statement.%PrepareClassQuery("%SYS.Namespace","List")
   set resultset=statement.%Execute()
   while resultset.%Next() {
       write resultset.%Get("Nsp"),!
   }
   quit

 

2. ターミナルから実行

USER>do ^getnsp
%SYS
DOCBOOK
SAMPLES
USER

 


こちらの記事でご紹介しているクラスクエリを実行する方法は、様々なケースで応用できます。

クラスリファレンスをご覧いただくと、様々なクラスクエリをご覧いただけます。
例えば、
 %SYS.DatabaseQuery:GetFreeSpace() データベースの空き容量
 %SYS.GlobalQuery:DirectoryList            データベース内のグローバル名一覧
 %SYS.GlobalQuery:Size                            データベース内のグローバルサイズ一覧
 %SYS.ProcessQuery:SS                           プロセス情報(^%SSユーティリティで確認できる一覧と同じ)
などがあり、様々な情報を取得できます。

他にもいろいろございますので、是非ご活用ください。

ディスカッション (0)0
続けるにはログインするか新規登録を行ってください
この投稿は古いことに注意してください。
お知らせ
· 2022年5月17日

[Video] Securing FHIR Applications with OAuth 2.0 (Part 2)

Hey Developers,

In the second part, you will learn how to build a FHIR Application with OAuth 2.0 and OKTA:

⏯ Securing FHIR Applications with OAuth 2.0 (Part 2)


🗣 Presenter: @Patrick Jamieson, Product Manager IRIS for Health, InterSystems 

Subscribe to the InterSystems Developers YouTube channel and stay tuned!

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2022年5月16日

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
続けるにはログインするか新規登録を行ってください
記事
· 2022年5月14日 8m read

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
続けるにはログインするか新規登録を行ってください