検索

記事
· 2022年1月26日 2m read

在 InterSystems IRIS 中使用网页版本的命令行工具 - Web Terminal

 

许多使用InterSystems IRIS的用户在调试代码的时候习惯使用命令行的方式,比如运行一个函数查看输出或者查看代码运行过程中保存在global中的数据等等。

对于将 InterSystems IRIS 安装在 Windows 操作系统的用户,只需要点击右下角图标选择Terminal 就可以很方便的使用。

但是对于将其安装到 Linux 或者Docker 容器中的用户,要使用命令行却不那么方便,下面我将会介绍在我们 Openexchange 中的一个应用 -- Web Terminal。

也就是说可以在网页中直接执行Terminal中的命令。

2016-09-18_212035

或者查看SQL执行结果:

2016-09-18_212244

可以在其中输入 /help ,获取更多帮助信息

2016-09-18_212325

安装

1. 点击进入项目下载页面,选择下载最新的版本。

2. 在任意的命名空间下导入下载的xml文件。

 

 

注意在这里选择导入文件的同时也要勾选上 “编译导入的项”

3. 之后会出现下面提示导入成功的提示

 

如果出现类似于下面的错误提示:

请将下载的 WebTerminal-v4.9.3.xml 文件编辑做下面修改

1 . 第1611行:修改为 

set requiredRole = "%DB_IRISSYS"

2. 第1730行:修改为

set dbPrefix = "IRIS"

重新导入就可以了。

使用

安装上面步骤安装完后,只需要在浏览器中输入网址:http://[host]:[port]/terminal/ (注意最后的 / 符号必须有)(比如:http://localhost:52777/terminal/

输入访问的用户名密码后,就可以进入网页版本的terminal了

在Openexchange中详细介绍的地址在这里,更详细的文档可以点击这里

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

How to call Event Log from cache prompt

How to execute it from the command line? I am able to use SQL in Management Portal, but I need to do it in Unix 


 select * from Ens_Util.Log where ConfigName='SFTPTo.HQ.SAFETRACE.DFT' AND Text LIKE '%Put Stream%' and TimeLogged LIKE '%2021-10-16%'

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

IRIS supports SMB protocol for remote folders?

Intersystems IRIS supports SMB protocol to connect and read files from remote folders (//foldername)?

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

How to find the dataset you need?

Hey community! How are you doing?

I hope to find everyone well, and a happy 2022 to all of you!

Over the years, I've been working on a lot of different projects, and I've been able to find a lot of interesting data.

But, most of the time, the dataset that I used to work with was the customer data. When I started to join the contest in the past couple of years, I began to look for specific web datasets.

I've curated a few data by myself, but I was thinking, "This dataset is enough to help others?"

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

12 Medical Datasets along with 43 tables dynamically created by using all-new LOAD DATA SQL functionality

 

Application to import 12 Datasets along with 43 tables dynamically by using  LOAD DATA command which loads data from a source into an IRIS SQL table. 
List of Datasets

Features

  • Dynamically creation of table based on the CSV file data.
  • Import dataset by using LOAD DATA functionality by Terminal or by web application.
  • Remove dataset programmatically by terminal or by Web Application.
  • Dynamically view Imported Data from Web Application.
  • Functionality to Import data into CSV, Excel or PDF Format.
  • Responsive web application to view the status of Dataset.
  • Any or All datasets can be install or Remove with single command.
  • Use of %SQL_Diag.Result and %SQL_Diag.Message tables with LOAD DATA

It is recommended to read related documentations LOAD DATA (SQL).

 

How to install or remove any Dataset from Terminal

Use below command to import particular Dataset by passing it's ID or pass 999 to import all DataSets

do ##class(dc.data.medical.utility).ImportDS(1)

Below is the main script to create table dynamically and load data by using LOAD DATA functionality. Please note that table is created dynamically 

//Get file name 
SET filename=tRS.Get("Name")
//Remove .csv from the file name
SET tableName=$REPLACE("dc_data_"_ds_"."_tRS.Get("ItemName"),".csv","") 
//Get columns based on the header row of csv file
Do ##class(dc.data.medical.utility).GetColTypes(filename,.coltype) 
//Dynamically create table based on tablename and column types
SET qry = "CREATE TABLE "_tableName_" ("_coltype_")"
SET rset = ##class(%SQL.Statement).%ExecDirect(,qry)
//Check if table created successfully
IF rset.%SQLCODE
{
   WRITE "ERROR : ",rset.%Message,!    
}
ELSE
{
  //Dynamically construct LOAD DATA statement
  SET qry = "LOAD DATA FROM FILE  '"_filename_"' INTO "_tableName_ " "_"USING {""from"":{""file"":{""header"":""1""}}}"
  SET rset = ##class(%SQL.Statement).%ExecDirect(,qry)
  // Check result set sqlcode, In case of error write resultset message
  IF rset.%SQLCODE
  {
   WRITE "ERROR Table : " _tableName_" IMPORT FAILED: ",rset.%Message,!
  }
  ELSE
  {
  WRITE "SUCCESS table : " _tableName_" created and "_rset.%ROWCOUNT_" Rows Imported Successfully",!
  }
}

Use below command to remove particular Dataset by passing it's ID or pass 999 to remove all DataSets
 

do ##class(dc.data.medical.utility).RemoveDS(1)

 

Below is the main script to remove table dynamically

//Get file name
SET filename=tRS.Get("Name")
//Remove .csv from file name
SET tableName=$REPLACE("dc_data_"_ds_"."_tRS.Get("ItemName"),".csv","")
//Drop table
SET qry = "DROP TABLE "_tableName
SET rset = ##class(%SQL.Statement).%ExecDirect(,qry)
//Check if table deleted successfully
IF rset.%SQLCODE
{
  WRITE "ERROR : ",rset.%Message,!          
}
ELSE
{
  WRITE "Table "_tableName_" deleted successfully",!
}

 

How to install or remove any Dataset from Web Application

Navigate to http://localhost:52773/csp/datasets/index.csp  application dashboard

If Dataset is not installed then install DataSet button will be visible and if Dataset is installed then Remove Dataset button will be visible.

Just press the desire button to install or remove any data set

 

How to view and export data from Dataset

Navigate to http://localhost:52773/csp/datasets/datasets.csp  View DataSets page.

Select particular dataset and then table from the list. Press Excel, CSV, PDF file button to export the data.

 

Thanks

2 Comments
ディスカッション (2)1
続けるにはログインするか新規登録を行ってください