Hi community,
I'm going to publish several articles on how to perform actions that you can do in the web portal but via code.
Today.... Web Applications via code
InterSystems ObjectScript is a scripting language to operate with data using any data model of InterSystems Data Platform (Objects, Relational, Key-Value, Document, Globals) and to develop business logic for serverside applications on InterSystems Data Platform.
Hi community,
I'm going to publish several articles on how to perform actions that you can do in the web portal but via code.
Today.... Web Applications via code
I have a routine tag that takes an argument and I want this argument to be an array reference. So I try something like:
do mytag(.myarr)
The mytag tag, adds subscripts to myarr.
When I evaluate myarr after the tag call, only the subscripts passed in are retained in myarr. The subscripts added by mytag are missing. Is there a way to pass an array so it will behave the way I want it to?
Hi all,
Are there limitations to the size of a file or stream that %XML.Reader will parse?
I am trying to parse a large, 573MB, XML file using either the 'OpenFile' or 'OpenStream' methods, but both return errors.
When I try to use the 'OpenStream' method I get a 'ERROR #6301: SAX XML Parser Error: input ended before all started tags were ended' error',
and when I try the 'OpenFile' method I get a 'ERROR #6301: SAX XML Parser Error: <STORE>'.
'%XML.TextReader' appears to parse the file OK, so I may be able to get use that as a workaround, but ideally I would like to get '%XML.Reader' working.
Hi,
When for any particular reason I need to update a record and don't want to pull the triggers, the keyword %NOTRIGGER can be used. But I've been trying to do the same when I change the row using the object approach, but I can't find it. Anyone knows if it's possible to avoid pulling triggers when working with objects?
Sadly, the utility "DISABLE^%NOTRIGGER" doesn't seem to exist ;-)
Thank you,
David
Hi,
What is the difference of class normal and date/time property and how to use in the script and what is the use of MINVAL and MAXVAL parameters?
Thanks
Hi!
Does anyone have a cleaner approach than this for looping through grouped NTE segments in order to set the segment ID in an ORM? I am aiming to avoid the NTE segments that may follow the PID segment and find the NTE's that follow the OBR segment. By using the below If statement in the While loop, I'm finding NTE's that have comments in the fourth field (PID NTE's tend not to have these in the messaging I'm seeing, I'm awaiting confirmation on this), as well as finding my newly inserted NTE segment using $FIND to locate the colon (I've concatenated some values).
the start date must always
be the first day of the effective salary month.
Good afternoon I am making a method of a class that I want to return a list of objects of another class that I have defined, example:
ClassMethod myMethod() As list of MyPackage.MyClass
{
}
But it gives me a syntax error, I try this and it works:
ClassMethod myMethod() As %ListOfObjects
{
}
But I would like to keep the typing.
Is there a way?
How do you initialise a list of objects of a particular type?
I have tried the following code and I get an undefined when I try to insert.
.png)
I can do this and it works but I don't know if it is correct.
.png)
Is there any way to do something like this?
Set a= New list of Accciones()
Thank you.
Hello All
I'm running into an issue performing UPDATES that I'm not getting on INSERTS. It's probably obvious, but I'm just not seeing it and could use a little help.
I'm going over an HL7 message and depending upon varying criteria, the relevent variables will get items added to them like the following:
Set patientId = pRequest.GetValueAt("PID:3")
Set sqlColumns = sqlColumns_",patient_id"
Set sqlValues = sqlValues_",?"
Set par($i(p)) = patientIdAfter compiling the variables, I check to see if accession number is found in the table.
set performInsert = 1
set performUpdate = 0
.Hi Community,
We're pleased to invite you to the upcoming webinar in Spanish called "ObjectScript - Persistence and Integration"!
Date & Time: July 19, 4:00 PM (CEST)
Speaker: @David Reche, Manager of the Dev Community in Spanish
Hi Community,
This post is to introduce one of my first project in COS, I created when started to learn the language and until today I'm keeping improve it.
The CosFaker(here on Github) is a pure COS library for generating fake data.
cosFaker vs Populate Utils
So why use cosFaker if caché has the populate data utility?
Ok the populate utility has great things, like the SSN Generator for example, but what to do when you have a field with a long description of a product? How to check if that table will list the emails or if that calculated property will count the days of the last user interaction.
Hi all.
I'm currently working with a system needing results from a lab system, and they can only accept a single OBR per R01 message.
The R01s from the source have multiple OBRs, so I need to be able to send a message per OBR.
I found a similar post where the example was using a BPL, however there's some additional trickery processing that I already have working within an ObjectScript Business Process and would like to avoid trying to recreate in a BPL.
Any sample code will be greatly received ![]()
Hi,
Is there any functionality available to generate FHIR bundle id (GUID)?
Thanks
I am working on tweaking our current patient load process. The roster input is in text pipe delimited format, parsed out and transforms it to a standard HS.Message.PatientSearchRequest, and send to business process for patient matching. Result is transformed into a standard ADT HL7 message using EnsLib.HL.Message class. I would like to know if there is another class I can use that will transform my output to a text flat file pipe delimited instead of HL7 format? any advice on how to do this is greatly appreciated.
Thanks!
Greetings, InterSystems community!
I am pleased to announce that the web terminal project, Caché WebTerminal version 4 gets its release! After long period of enhancing this web application from 2013, it came to the version 4, which features major stability and security improvements, intelligent autocomplete and syntax highlighting, convenient SQL mode and a lot of other useful features.
The goal of this article is to spread the knowledge about this project over the InterSystems community.
Hi Developers!
A question to those who use VSCode to code InterSystems ObjectScript.
Suppose you have the ObjectScript code on IRIS server and you want to export it into the desired folder.
And you have VSCode connected to the server.
What is the way to tell VSCode that I want to export classes into some particular folder in /package/class.cls way?
E.g. into:
/project_folder/src/cls/Package/class.cls
and project_folder is opened in VSCode as the folder of the project.
Here are a few examples of conversions and operations you might need, along with links to documentation where you can learn more.
At the time I wrote this, Eastern Daylight Time was in effect for my Caché system.
Caché has a simple time format, with a longer range of recognized dates compared to some other technologies.
The current time is maintained in a special variable $HOROLOG ($H):
USER>WRITE $H 64146,54027 USER>
The first integer is the count of days since December 31, 1840. The second integer is the count of seconds since midnight of the current day.
Hi,
I have the requirement to dump large result sets into files. I am currently using %SQL.Statement and the result set created by it.
The DisplayFormatted is used to write a CSV. The query I used to test does not contain any filters, it is just a select * from a table with 16 million rows.
The file created is 2GB in size. The issue I have is that it takes 8 hours to create this file.
I have seen in the past that file streams write fast at the start. As the file continues to grow, the process' memory usage increases until it reaches the max allowed.
Hi all, I am new to IS Objectscript and I would appreciate some assistance regarding this.
I am trying to find out how to count the number of elements within a dynamic abstract object and I am having some trouble using the size method.
Here is the code below:
The key value pairs are originally in JSON and I would have converted it in to an object for use.
Class JSON.I'm looking for a way to get the message header ID for the current message in a Request to a Business Process.
I've located some code that gives me what I need, but it runs the risk of violating the "abstraction layer" ISC has in place around such things. And while I very much appreciate their efforts at keeping things simple for me ... well, sometimes you just have to dig through the guts to get what you want.
Is there a documented, deprecation-resistant method for getting at %Ensemble("%Process").%PrimaryRequestHeader.%Id() from within a BP?
I've been tasked with an interface that needs to supply some additional metadata for the indexing of HL7v2 messages. After toying with a couple of ideas, I thought that it would be useful to subclass EnsLib.HL7.Message, add a %DynamicObject property, and store the metadata in it (it ends up getting sent to the target in JSON form anyway).
And, well, it seems to work just fine ... so far.
I seem to remember that %DynamicObjects are not persistent, and for that reason not something you would normally stuff into a database.
for debugging purposes of complex applications.
Hey I am very new to Intersystems Objectscript and I am trying to find a way of extract 4 digit numbers from a stream.
I have a stream full of results
2334
3434
5543
4334
And I am trying to remove each 4 digit grouping from the stream.
I have tried the following for loop
for i=1:1:$length(result) {
set curr = $extract(result, i)
write !, curr
set count(curr) = $get(count(curr)) + 1
}
Unfortunately the loop extracts one digit.
Does anyone have any suggestions on how to solve this ?
Hi all
I'm trying to recreate this method below in Cache/IRIS.
https://en.wikipedia.org/wiki/Luhn_mod_N_algorithm ISO-7812-1 (LUHN-10)
I've been following the javascript example. It seems simple in theory but i'm struggling with which cache methods to pick.
$LENGTH, $System.SQL.FLOOR() - seem ok
$EXTRACT - I think for .charAt (though may need to correct base)
$FIND - for .indexOf
Any suggestion which would be the best ones for the job?
Thanks
Dan
Hi Community,
We're pleased to invite you to the upcoming webinar in Spanish called "Learning ObjectScript from scratch"!
Date & Time: May 25, 4:00 PM (CEST)
Speaker: @David Reche, Manager of the Dev Community in Spanish
The webinar is aimed at:
Awhile back the Developer community helped me with a situation I was having... How to loop through a Repeating Segment and Single Filed, example OBX().5, within a Business Process Rule and compare it against a Data Lookup table.
Well now I need to take it a step further. I need a way to loop through OBR() segment, and loop through OBR().4() and the subfield 4.1 and compare it to a Data Lookup table.
So I thought I could copy my existing function code and add another level to it, but its not returning what I would expect.
Hi developers!
I have an existing CSP app and I want to add a role to it. How can I make it programmatically?
Hi! I have a promblem with ##class(%File).Exists -method and scandinavian characters.
Ensemble: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2018.1.2 (Build 309_5U)
I have a business service (EnsLib.EDI.XML.Service.FileService (charset=binary)) which reads XML-files from the server and transmits those to the business process. BP request class is EnsLib.EDI.XML.Document. In BP I have code block
SET SourceConfigName = process.%PrimaryRequestHeader.SourceConfigName SET SrcPath = ##class(Ens.Director).GetAdapterSettingValue(SourceConfigName,"FilePath",.tSC) SET AttachFileName = request.