查找

Question
· Jul 4, 2024

Convert 2024-07-04 13:21:16.477 to 20240704132116

How can I convert

From = 2024-07-04 13:21:16.477

To = 20240704132116

3 Comments
Discussion (3)2
Log in or sign up to continue
Question
· Jul 4, 2024

Recommended way to read ???? ?? ??? files

Hello,

First of all thanks for your time reading this question, and thank you for your help.

🎯 We would need to create an Ensemble HealthShare Operation to read files from a FTP / SFTP server.

We have coded:

Class Operaciones.FTP.ConsultaPDFv01r001 Extends Ens.BusinessOperation [ ProcedureBlock ]
{

Parameter ADAPTER = "EnsLib.FTP.InboundAdapter";

Method ConsultarDocumentoPDF(pRequest As Mensajes.Request.ConsultaPDFRequestv01r00, Output pResponse As Mensajes.Response.RecuperarDocumentoPDFv01r00) As %Library.Status
{
	set ftp = ##class(%Net.FtpSession).%New()
	
	set isConnected =  ftp.Connect(..Adapter.FTPServer, ..Adapter.Credentials.Username, ..Adapter.Credentials.Password, ..Adapter.FTPPort) {
	
	$$$LOGINFO($System.Status.GetErrorText(isConnected))
	$$$LOGINFO(isConnected)
	
	if isConnected {
		$$$LOGINFO("HOLA")
		do ftp.SetDirectory(..Adapter.FilePath)
		set stream=##class(%GlobalCharacterStream).%New()
		;set tsC = ftp.Retrieve(pRequest.nombreDocumento, .stream)
		;if 'tsC { $$$LOGERROR("Error al recuperar el documento") }
		if 'ftp.Retrieve(pRequest.nombreDocumento, .stream) { $$$LOGERROR("Error al recuperar el documento") }
		else{
			$$$LOGINFO(stream.Read())
		}
	}
	Quit $$$OK
}

XData MessageMap
{
<MapItems>
	<MapItem MessageType="Mensajes.Request.ConsultaPDFRequestv01r00">
	     <Method>ConsultarDocumentoPDF</Method>
	</MapItem>
</MapItems>
}

}

When we try this operation from the Web Portal, we always get the following result:

First loginfo outputs: "ERROR #00: (sin descripción de error) [no error description]"

Second loginfo shows: 0

 

We have verified that the IP and Port of the server are correct, but we do not understand why it does not connect.

We know that the code does not enter inside the if which checks if it isConnected

set isConnected =  ftp.Connect(..Adapter.FTPServer, ..Adapter.Credentials.Username, ..Adapter.Credentials.Password, ..Adapter.FTPPort) {

if isConnected {

 

How could we get what exact error is happening?

 
🔎 We have also read:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

https://community.intersystems.com/post/how-does-enslibftp-use-netftpses...

https://community.intersystems.com/post/ftp-file-download-all-files-no-f...

https://community.intersystems.com/post/using-and-debugging-netsshsessio...

https://community.intersystems.com/post/how-download-files-ftp-server-lo...

https://community.intersystems.com/post/how-uploaddownload-image-files-f...

https://community.intersystems.com/post/how-get-files-ftp-server

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

 

🎯 How would you accomplish this task, to be able to read a file from a FTP / SFTP server in HealthShare 2020?

 

Thanks for your time, and thank your for your replies.

🐱‍💻🐱‍💻🐱‍💻
 

5 Comments
Discussion (5)3
Log in or sign up to continue
Question
· Jul 4, 2024

Responsividade de dados em aplicações no terminal.

Bom dia. Comecei a estudar o Caché a menos de um mês, de lá pra cá testei várias funcionalidades mas há uma que eu não consegui encontrar. Como posso fazerem meus dados serem responsivos quando representados em tabelas no terminal?

Exemplo (dados fictícios):

 

Atualmente eu resolvi este problema por meio de um algoritmo que consiste em ter uma string que tem a quantidade de espaços igual a quantidade de colunas do terminal, um dado (como por exemplo o nome) e uma substring da primeira que tem um tamanho igual a quantidade de caracteres delimitada para aquele campo subtraída da quantidade de caracteres do dado em si.

Exemplo:

Obviamente esta solução não é boa por vários motivos, primeiro que se mudar o tamanho do terminal ela já não funciona em si. Segundo que se o tamanho do dado for superior ao tamanho delimitado para o campo a responsividade quebra. Então se souberem como posso fazer para deixar os dados de maneira responsiva sempre, ficaria agradecido.

1 Comment
Discussion (1)1
Log in or sign up to continue
Article
· Jul 4, 2024 2m read

ファイルに入力された文字列をバイト単位で読み込む方法

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

InterSystems製品のサーバサイドでファイル入出力を行うと、文字列はシステムで設定されたファイル入出力用文字コードに自動変換され、文字単位でREADします。

ファイルから入力する文字をバイト単位で操作するためには、自動変換を行わない無変換の状態でファイル入力を行い指定バイトずつ読みながら読んだ分だけUnicodeに手動で変換していく必要があります。

変換には$ZCONVERT()関数を使用します。($ZCONVERT()には省略形があり$ZCVT()でも同様の操作が行えます。)

なお、READした指定バイトを変換する際、文字の全バイトが含まれない場合もあるため、途中までの読み取りになった文字列を第4引数に指定する変数に設定できるようになっています。
次回読み取り時に途中だった文字を自動的に先頭に追加し、$ZCONVERT()の処理を実行します。

《メモ》ファイル入出力の文字コードについては、以下管理ポータルの画面で確認できます。
管理ポータル > 構成 > 国際言語設定 > 構成したデフォルト値
 入力/出力テーブルの表の「ファイル」

以下の文章がファイルにUTF8で保存されているとします。

2024/4/19:強風でしたが良い天気でした

 

無変換でファイル入力を行うには、%Stream.FileBinaryクラスを使用してファイルをオープンします。

5バイトずつ入力する例は以下の通りです。

set fb=##class(%Stream.FileBinary).%New()
write fb.LinkToFile("c:\temp\memoU.txt")  //ファイルをリンクできると1が返ります。
set data=fb.Read(5) // 5バイトずつREAD
//UTF8からUnicodeに変換するため第2引数は"I"を指定します
// 第3引数はUTF8(大文字)を指定し、第4引数に変数hadleを指定します。
//write $ZCONVERT(data,"I","UTF8",handle)," - ",handle
//EndOfFileを検出するとAtEndプロパティに1が設定されることを利用してループします。
while (fb.AtEnd=0) { set data=fb.Read(5) write $ZCONVERT(data,"I","UTF8",handle)," - ",handle,! }

kill fb  //ファイルをクローズします

While文に含まれるWRITE文の出力結果は以下の通りです。

2024/ -
4/19 - ï
:強 -
風 - ã
でし - ã
たが -
良 - ã
い天 - æ
気で -
し - ã

 - 
Discussion (0)1
Log in or sign up to continue
Announcement
· Jul 4, 2024

[Vídeo] Presentación de InterSystems Supply Chain Orchestrator

Hola Comunidad, 

Tenéis disponible un nuevo vídeo (en inglés) en el Canal de YouTube de InterSystems:

⏯ Presentación de InterSystems Supply Chain Orchestrator @ Global Summit 2023

Aprended qué contiene InterSystems Supply Chain Orchestrator. Descubrid cómo se puede utilizar para optimizar las cadenas de suministro y proporcionar información prescriptiva procesable. A través de presentaciones y una demostración en vivo de las capacidades clave del producto, aprenderéis por qué acelera el tiempo de creación de valor para la transformación digital de la cadena de suministro.

Ponentes:
🗣 @Ming Zhou, Head of Supply Chain Strategy, InterSystems
🗣 @Annie Tong, Supply Chain Sales Engineer, InterSystems

¡Disfrutadlo y estad atentos a más vídeos! 👍

Discussion (0)1
Log in or sign up to continue