Hi Developers,
New video is already on InterSystems Developers YouTube:
⏯ Embedded Python for ObjectScript Developers: Working with Python and ObjectScript Side-By-Side
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 Developers,
New video is already on InterSystems Developers YouTube:
⏯ Embedded Python for ObjectScript Developers: Working with Python and ObjectScript Side-By-Side
Setting the Scene
I was editing the properties of a persistent ObjectScript class the other day and noticed that the storage definition wasn't updating to reflect my latest changes.
In this case, I deleted a property that was no longer needed from the class definition, saved, recompiled, and still saw it in the storage definition.
No problem, I thought. If the storage definition gets autogenerated on compile, I can just delete it and recompile the class. Sure enough, after doing this, I no longer saw the deleted property in the storage definition.
There, problem solved.
I've found a couple of methods that will tell me whether a package is mapped from another database, but not which database. Is there such a method/routine?
I have an auditing class that defines some sqlComputed properties and can be extended by other persistent classes to enable auditing of its properties.
Class Audit.ModifiedTracker [ abstract ] {
/// Last time this record was saved
Property LastModifiedTime As %TimeStamp [ SqlComputeCode = {Set {*}=$zdt($zts,3)}, SqlComputed, SqlComputeOnChange = ("%%INSERT", "%%UPDATE") ];
/// User responsible for modifying record
Property LastModifiedUser As %String [ SqlComputeCode = {set {*} = ..GetModifiedUser()}, SqlComputed, SqlComputeOnChange = ("%%INSERT", "%%UPDATE") ];Hi folks!
I'm curious if it is possible to change the class method to another class?
I call a method of a system class to generate another class. But there is a bug/feature in a library class, so I need to tweak a bit the generated method, e.g. add additional parameter and change the line to "if" the parameter.
I hope to do this programmatically after class generation and change the code in a way I like.
What are the options?
Hey InterSystems Community,
I noticed something interesting in regards to business rule editing. Whenever you use the Management Portal or Studio to edit a business rule, the " characters gets escaped to a ".
.png)
Which results in the following code:
As long as you are not mixing development styles - as in, sticking to only the UI or only the code, it is not a problem. But as soon as you mix both, the escaping starts to hinder readability of the rules a bit. I noticed that this is not the case with other interoperability features, like data transformations.
I need to store an equivalent of the SNN (Social Security number). I need it to be encrypted and I'll have to be able to search for it once stored.
For what I've seen my options are:
- SHAHash from the %system.encryption library. Simple and easy to implement. My question is, might collisions be a problem? We are talking about a 10 millions entry.
- AES encryption. In this case I'd like to know if there is a standard way for key management in the InterSystems environment.
I can eventually get a certificate for this project to use other encryption function as well.
Open to suggestions.
Hi Dev Community,
I have a persistent Document class that has a FileName string property and another Question class that has an optional one-to-many relationship with Document.
I'm trying to add a SqlComputed property to the Question class (docFileName) where docFileName = Document.FileName if there is a related Document or an empty string if there isn't one.
I'd prefer the property to be SqlComputed so that if Question.Document changes, Question.docFileName will automatically update.
Does anyone know the syntax for accessing the properties of a related object in the SqlComputeCode?
Thanks!
Hi all,
I'm trying to output a XML file, mapped from a ORU_R01 2.3 HL7 message, with a file name based of fields in the source HL7 message in the following format,
source.{PIDgrpgrp(1).PIDgrp.PID:PatientIDInternalID(1).ID}_"-"_
source.{PIDgrpgrp(1).PIDgrp.PV1grp.PV1:VisitNumber.ID}_"-"_
source.{PIDgrpgrp(1).ORCgrp(1).OBR:ObservationDateTime.timeofanevent}
To give something like RXR0000000-000000123-20211125105415.xml as the output filename,
I initially tried to extend the EnsLib.XML.Object.Operation.
.png)
Welcome to day 3 of Virtual Summit 2021! We have incredible content available to you this year and I'd just like to bring your attention to the 4(!) sessions that we have on Embedded Python.
Hello,
I am trying to pass a pattern in the Ensemble function Matches(val,pat) in Business Rule as below.
Eg.
Matches(tSite, " 1(.E1 "SITE A ",.E1 "SITE B ") ")
tSite is a variable containing the site name
Want to check if the variable contains any of the site name.
But i receive a parsing error when compiling.
Is there another way to pass the pattern in the Matches function or any other similar function which i can use in the business rule or DTL without multiple sentences with Contains.
Thanks,
Jimmy Christian.
Hi all,
I'm using a snippet I found from Scott Roth to extract, decode, and save a PDF from a HL7 message and save it to a specified file path, but I'm running issues with the following error:.png)
My approach was to a create a utility function accessible from a DTL like this:
Class ELHTPRODPKG.Functions.Utility.ExtractPDF Extends Ens.Rule.FunctionSet
{
ClassMethod DecodeBase64HL7(base64 As %Stream.GlobalBinary, Path As %String, FileName As %String) As %String [ Final ]
{
//Debug
WRITE $LENGTH(base64)
// Decode
set Oref = ##class(%FileBinaryStream).%New()
set Oref.Filename = Path_FileName
Do base64.Rewind()
While 'base64.AtEnd
{
set ln=base64.ReadLine()
set lnDecoded=$system.Encryption.Base64Decode(ln)
do Oref.Write(lnDecoded)
}
Do Oref.%Save()
return Oref.Filename
}
}If a have a string " Happy new year " and I want to trim (remove blank spaces from the begin and the end, not other places into the string), what is the object script function to get "Happy new year"?
Hi, Community!
Open Exchange (OEX) is getting more and more popular and more and more developers consider publishing their apps in the public package manager registry.
This is really great!
So the topic of thoughtful naming convention is getting more important and even critical. Let's discuss?
Hi all
I'm new to ObjectScript and I've been experimenting the correlate method of %XML.Reader to convert an XML file I've loaded into its corresponding class. But, I have found that I am not getting all the child items of an element in a List contained within the converted class, only the last item.
I programmed some server command by my own. That server commands worked fine for a long time.
Suddonly I received
Studio Action "Attempted Edit" not supported on 127.0.0.1:57772[CTAE01]
by using one of my server commands.
There is an explanation:
Error running command vscode-objectscript.serverCommands.contextOther: Running the contributed command: 'vscode-objectscript.serverCommands.contextOther' failed.. This is likely caused by the extension that contributes vscode-objectscript.serverCommands.contextOther.
Can you help me to solve that issue?
Hi folks!
Is there any templating engine for ObjectScript similar to Jinja?
Or is there any way to use csp's built-in tools to do this?
Ideally, I want to input the template and data into the function and get the ready to use html in the output.
I often get this message when trying to attach to the routine second time. The only way I was able to fix this is by restarting the Cache server.
Then I can do debugging once, but second time, the error pops up again. Very annoying. Is there a way to fix that without restarting the server ?
Thank you
Dean Kavicki
Hello,
How I can unpack rar archive with 7z program in COS?
InterSystems technologies are renowned for their high performing databases, which support the systems and operations of many organisations. However a key ingredient to this success is the quality and maintainability of their code.
The quality of code can impact everything from speed and ease of fixing bugs and making enhancements, to the overall performance of your organization and your ability to get ahead in the marketplace.
By ensuring your code is maintainable, you can reduce approximately 75% of the systems life cycle costs*. This is why, at George James Software, the solutions we build are always straightforward and written in high quality code - because we know that this solid foundation can positively impact the rest of your organization.
With a maintainable system you're able to reduce your overall maintenance as any issues that occur are significantly faster to identify and fix. This means you're free to allocate that time and budget to enhancements, enabling you to get the most value out of your applications and ultimately better support your organization.
Keep an eye out for our next few posts about what a maintainable system looks like and the tools that can help you keep your code maintainable, in order to help you to reduce those maintenance costs.
In the Caché Foundations course, students are learning about Caché Development and ObjectScript syntax at the same time. To help students complete the exercises, we provide an ObjectScript Quick Reference (aka "the Cheat Sheet").
It is not a reference for all of ObjectScript! It is a list of the ObjectScript commands and functions that students use during the course, along with common syntax for objects, collections, etc. It also contains some useful macros.
We are providing a pdf version to the Developer Community.
Why I love ObjectScript and why I think I might love Python More
I was looking at the thread of messages on the topic of "Performance when constructing a comma-separated string", and I started writing a response but got distracted, the page refreshed, and I lost my text. I couldn't spend the time rewriting my response, so I started writing this document instead.
I started writing MUMPS at the beginning of my career. I wrote very tight and dense code blocks where exercises such as the string example were authentic challenges.
Hello,
I don't know if the title is accurate enough. I have a legacy code that I need to optimize. It's a routine written in objectscript. It accepts 4 parameters and runs 6 nested FOR...$ORDER reading a big global.
The thing is when I run the routine the first time it takes around 60 seconds to run. If I run it again it takes 5 seconds. If I wait around 6 to 10 minutes to run it again, it takes 60 seconds again, but if I run it every 1, 2, 3... minutes it still takes only 5 seconds to run.
I am receiving the following error in my buisness operation:
ERROR <Ens>ErrException: <UNDEFINED>zGo2+181^mb.MbMainOperation.1 *tSC -- - registered as '-' number - @' set pResponse = ##class(mb.MbMessageResponse).%New()'
From what I understand, the problem occurs in the generated int file mb.MbMainOperation.1 in the method zGo2, with the offset of 181 lines, and the variable in question is a local variable tSC.
However, the line where the error occurs does not refer to tSC in any way
set pResponse = ##class(mb.MbMessageResponse).
At the moment I am trying to write a documentation file for a project and intend to use LaTeX for it.
Has anyone already had experience with this? I haven't found syntax highlighting with the LaTeX packages I know yet.
I found a request on Pygment but it was from 2016 and there was no reply on it since then.
Does anyone know a simple way for syntax highlighting COS in LaTeX?
Thanks for your input!
Martin
If I open a terminal and type the following commands, sc is an error:
set validator = "sc = ##class(%Library.Numeric).IsValid(""BLAH"")"
set @validator
write scAt the end, when I write sc I get:
0 L'BLAH9
DOCXT010,#e^zIsValid+1^%Library.Numeric.1^1e^^^1However, if I call the following class method using the arguments "%Library.Numeric" and "BLAH", sc is undefined
ClassMethod testvalidator(class As When it tries to write sc, I get:
And I can't figure out what's making that different.
I am trying to figure out the best ObjectScript analog to mimic, more or less, the %RCOPY functionality. What would be ObjectScript method(s) if any to copy a routine from the current namespace to another one and compile it there?
Hi
Following API:
http://api.aladhan.com/v1/gToH?
I have a %Stream that I want to insert some text into the middle of. I create a new stream called pNewContentStream from the original stream, then I do a MoveTo in pNewContentStream to get to the byte position I want to insert into but when I do my Write, my pNewContentStream gets obliterated with only the text that I wrote, the original content goes away and all I'm left with is my Write text.
Method AddContentTypeCode4(pContentStream As
The trace labeled "