Hi @Muhammad Waseem, in the end I found a solution modifying the settings.json file, which contained all the info about my connection
- Log in to post comments
Hi @Muhammad Waseem, in the end I found a solution modifying the settings.json file, which contained all the info about my connection
Hi Muhammad, great article!
Do you know by chance how to switch from an instance to another through the ObjectScript extension?
I have a local folder where I'm setting up a Docker instance, but the folder is linked to my IRIS local instance and it is not possible to unlink them even by doing Toggle connection or Refresh connection. Of course, I would like to connect to my containerized instance instead.
Thanks :)
I would like to export the project as an XML file, as is it possible in Studio
Hi @Brett Saviano,
thanks for the information! I just mentioned it in the proper section of my article.
You're welcome 😊 I'm happy you found it useful
Thank you Brett,
if it's feasible for you, link this article to the one you're writing in order to connect articles on similar subjects. I'll do the same
Hi, you can try something like this:
Set sc = $$$OK
// Send a GET request
Set messageStatus = httpRequest.Get()
// Analyze response code
If '($$$ISERR(messageStatus)) {
If httpRequest.HttpResponse.StatusCode = 200 {
// If a positive response was received
// ...
// ...
} ElseIf httpRequest.HttpResponse.StatusCode = 404 {
// Manage an HTTP status error
// ...
// ...
// If you want a custom error status
Set ErrorText = "This is a string that contains your custom error text"
Set sc = $$$ERROR(ErrorCode, ErrorText)
} Else {
// You can manage other HTTP codes here
}
} Else {
If '($ISOBJECT(httpRequest.HttpResponse.StatusCode)){
// Manage an error raised if the endpoint couldn't be reached or if you didn't get a response in time
// ...
// ...
Set ErrorText = "This is a string that contains your custom error text"
Set sc = $$$ERROR(ErrorCode, ErrorText)
}
}
Return scYou can manage any status code in the way you prefer (not just code 200 or 404)
I know that answering a question and providing your own response may seem unusual, but I won't delete this question as it could be helpful to someone in the future.
The issue was related to the method "jsonFormatter.FormatToStream", which returned "ByRef" a pStream object that, for some reason, Postman and the other client software didn't handle well.
A solution is to remove the jsonFormatter and to pass directly the OriginalStream to the function:
Set pResponse = ##class(EnsLib.HTTP.GenericMessage).%New(OriginalStream,,tHttpResponse)If you prefer to keep the JSONFormatter, just declare the pStream as an object of %Stream.FileCharacter class before using the FormatToStream method:
// Format the newJson with the correct indentation
Set jsonFormatter = ##class(%JSON.Formatter).%New()
// Declare a new stream object
Set pStream = ##class(%Stream.FileCharacter).%New()
Set sc = jsonFormatter.FormatToStream(jsonACK, .pStream)
Now everything works fine.
Thanks!!
Thanks, Julius! That was part of the problem. I'm still facing some issue but now I'm able to reach a web service deployed with another program (in the next days I will retry with Render).
The Gateway is very interesting, but could it work on 2021.1?
Edit. I think so, as on Github it says IRIS supports the Gateway from version 2020.3. I will try it, thanks!
Ok, probably that's the problem. I was looking for this information but I couldn't find it before. I'm not sure if I can upgrade the remote server. Is there an alternative?
Thanks!
I don't know if this can help, but in objectscript the command to extract some elements from a list is the following:
SELECT * FROM <tableName> WHERE FOR SOME %ELEMENT (<listName>) (%VALUE = '<value>')
For example, if you have a persistent class like this:
Class User.SQLtable Extends %Persistent
{
Property propertyList As list Of %String(MAXLEN = 100) [ Required ];
Index ListIdx On List(ELEMENTS);
}You can extract information using:
SELECT * FROM User.SQLtable WHERE FOR SOME %ELEMENT (propertyList) (%VALUE = '67')
In this way you can retrieve the row that contains the specific data value of interest with dynamic or static SQL and subsequently extract the list as a property of the SQL result object
Hi Enrico,
Thank you for the response. I've tried both adding an OnFailureTimeout method in my custom BO and directly modifying the OnFailureTimeout method inside the Ens.BusinessOperation. However, in the first case, nothing happens, while in the second case, the error "ERROR #5883: Item 'Ens.BusinessOperation' is mapped from a database that you do not have write permission on" occurs
Thanks! This is what I was looking for, it's a good idea.
Hi Ashok,
Thank you for your response. As I said to Ian, maybe I expressed wrong and I apologize for any confusion, but I did not intend to start a new line within the log that is printed in the Visual Trace. Instead, I wanted to start a new line within VSC in order to avoid writing long one-line logs in the visual interface of VSC.
For example, I am looking for a way to transform this line of code:
$$$LOGINFO("this is the first line "_$c(13,10)_"this is second line"_$c(13,10)_" this is third line")Into something like that, to improve code readability:
$$$LOGINFO("this is the first line "
_$c(13,10)_"this is second line"
_$c(13,10)_" this is third line")Hi Ian,
Thank you for your response. Maybe I expressed wrong and I apologize for any confusion, but I did not intend to start a new line within the log that is printed in the Visual Trace. Instead, I wanted to start a new line within VSC in order to avoid writing long one-line logs in the visual interface of VSC.
For example, I am looking for a way to transform this line of code:
$$$LOGINFO("this is the first line "_$c(13,10)_"this is second line"_$c(13,10)_" this is third line")Into something like that, to improve code readability:
$$$LOGINFO("this is the first line "
_$c(13,10)_"this is second line"
_$c(13,10)_" this is third line")This is really impressive! I will try it soon, thanks!
No, I don't have any HTML-type formatting. This is the message displayed through the trace:
|
object: 'No response or error was received in reply to the previous message, attempting to resend the message.', |
To display this message in the visual trace, I used the following code:
$$$TRACE("object: 'No response or error was received in reply to the previous message, attempting to resend the message.', "_$CHAR(10)_"retryCount: '"_..RetryCount_"'"_$CHAR(10)_"ResponseTimeout: '"_httpRequest.Timeout_"'")I used $CHAR(10) to insert a new line since the $$$TRACE command isn't affected by syntax like "\n."
Hi Pravin,
You can use the syntax ./folderName in the files to include camp from the Search panel.
This is my workspace
.png)
I have 3 folders: 2 on a remote server and one in local.
If I would like to restrict the research only to a remote folder I can type: ./npri_server_fhir:OMR
As shown in the following picture:.png)
Make sure you have followed the procedure outlined at this page (InterSystems ObjectScript extension for VS Code), under Enable proposed APIs, to enable the search across all folders.
Thank you Alex, how can I modify the OnFailureTimeout method for my purpose? I can find only a little documentation
Thank you Luis, this was useful.
However, I've encountered two issues while adapting the code you provided to my specific situation:
if ..RetryCount = 1 {
; Find the production
#dim p As Ens.Config.Production
Set p = ##class(Ens.Config.Production).%OpenId("ProductionName")
if '$isObject(p) {
$$$LOGERROR("Production not found")
quit
}
#dim item As Ens.Config.Item
#dim sett As Ens.Config.Setting
; Loop over all the elements of the production
for i=1:1:p.Items.Count() {
s item=p.Items.GetAt(i)
; Find the desired business component
if (item.Name="Component1Name"
||(item.Name="Component2Name"))
{
$$$LOGINFO(item.Name_" found")
; Explore settings
for s=1:1:item.Settings.Count() {
set sett=item.Settings.GetAt(s)
; Search for the FailureTimeout
if (sett.Name="FailureTimeout"){
$$$LOGINFO(sett.Name_" found")
; Change the valure of the FailureTimeout based on the Severity
If Severity = "high" {
set sett.Value = -1
} Else {
set sett.Value = 30
}
}
}
}
}
Set sc = p.%Save()
If $$$ISERR(sc) {
$$$LOGERROR($System.Status.GetErrorText(sc))
quit
}
}
With this code, I can adjust the FailureTimeout value based on the Severity parameter, and the updated value is correctly shown in the Production settings. Nevertheless, there are a couple of issues:
Thank you! Congratulations to the other authors for their interesting questions, and to the rest of the community members for their responses!
Hi Rich, sorry for the late response but I've worked on other projects for some times.
I believe the issue with my code lies in the fact that the POST request was sent via a %Net.HttpRequest object:
// Send an HTTP POST request
Set messageStatus = httpRequest.Post(operation)rather than using directly the adapter:
set tsc = ..Adapter.PostURL(URL,.tResponse,,InputStream)so the Timeout property of the %Net.HttpRequest object wasn't affected by the change on Response Timeout.
I solved this issue with a little help of @Menno Voerman's suggestion:
Set tHttpRequest.WriteTimeout = ..Adapter.WriteTimeout
Set tHttpRequest.Timeout = ..Adapter.ResponseTimeout
Set tHttpRequest.OpenTimeout = ..Adapter.ConnectTimeout In this way is possible to modify the response timeout dinamically too.
I'm not sure if switching to the Adapter.PostURL method is a better choice compared to using httpRequest.Post. For now, I'm using the latter to minimize changes in my code.
Thanks Tani, this was very helpful!
Thanks for the suggestion, I will!
To conclude this discussion, I've summarized the solutions that have been suggested:
Additionally, I've come across a few more solutions:
"IRIS Terminal": {
"path": [
"C:\\InterSystems\\IRISHealth\\bin\\irissession.exe"
],
"args": ["IRISHEALTH"],
"icon": "terminal-cmd"
}Note: Select the right path of irissession.exe.
c. Navigate to: Terminal > New Terminal > Launch Profile… > IRIS Terminal.
Host my-putty-connection
HostName < IP address or server name >
User < username >
IdentityFile < private key path on your local machine >
Port < port >Thanks Evgeny, this is a good solution for who use Docker!
Thanks John, this is an interesting feature! Unfortunately I've only IRIS 2021.1 😓