Trying to gather basic code examples written in ObjectScript and realized it's probably easiest to ask the people who know what they're doing!

I'm looking for examples of the following five prompts all in ObjectScript:

Prompt 1. Write a function that partitions the array into two subarrays: one with all even integers, and the other with all odd integers. Return your result in the following format:

[[evens], [odds]]

Prompt 2. Create a function that computes the hamming distance between two strings

0 3
0 172

I have a situation where I have a handful of classes which I need to copy to another Namespace (which uses a different RoutineDB) on the same instance, load it and compile it.

Can anyone help me come up with a command that will do this quickly and easily? Perhaps something with extended reference?

This is somewhat time sensitive so thank you in advance for your ideas!

0 23
0 601

Has anyone had success with passing in a collections property within a SOAP request to a Soap Service in Ensemble? Please reply with how you set up that collections property. I am able to successfully send a SOAP request correctly containing the elements of the collection property to Cache, as seen in a custom soap log file which I am using to troubleshoot. But the collection property in the Ensemble request is not getting serialized, meaning MyContainers has nothing.

My.Request consists of a property, MyContainers, which can have 0 or more Containers (My.Container)

0 1
0 107

I'm trying to write an ObjectScript function that sorts version numbers to help learn ObjectScript. This is all I can think of after staring at VS Code for a while, but I don't know where to go with it. Can someone please help out with a tip? The goal is to take something like ["1.4.5", "0.5.3", "6.3.2", "1.2.4"] and turn it into ["0.5.3", "1.2.4", "1.4.5", "6.3.2"]

0 4
0 214
Question
· Apr 13, 2023
Breaking a string into words

Is there any ObjectScript or a basic function that takes a string and separates it into words + punctuation/spaces array/list? Just not to reinvent the wheel. Say, process "It is a test, after all" into "It", space, "is", space, "a", space, "test", ", ", "after", space, "all". Or something to that effect.

2 9
0 319

I have a %GlobalBinaryStream object that I'm trying to save as a local file after being received through a SOAP Web Service.

To do this, I created a %Stream.FileBinary object and wanted to set where the stream copied to this object would be saved by using either the DefaultStreamDir() ClassMethod or the NewFileName() ClassMethod. However, the documentation isn't very helpful on how to use these ClassMethods.

Right now, I have the below code:

1 4
0 197

I wrote a function awhile back to take Encoded Base 64 and write the PDF out to a file that could be sent to a faxing system to fax out. We are trying to test this code out in IRIS and I am seeing an error that I have not seen before... ERROR #5034: Invalid status code structure

Here is the code...

ClassMethod DecodeBase64HL7ToFile(base64 As %Stream.GlobalBinary, Ancillary As %String, FileName As %String) As %String

{

set ArchDir = "/ensemble/data/transfer/AncillaryPDF/"

0 7
0 271

We have a function that was written for us that allows us to create text files for logging certain aspects to the OS using %Stream.FileCharacter. We had no issues with this until we moved from AIX to Red Hat.

Now it seems the 1st time the function is called, and the file is created the permissions seem to be correct on the file. But as soon as we attempt to write another line to the file using MoveToEnd() it seems the permissions are changed on the file. I have been able to narrow the issue down to the MoveToEnd() by calling the function from different users.

0 9
0 396
Question
· Feb 18, 2019
%String to XML

Hi

I've got a string variable which I need to convert into a XML one.

My main goal here is to use the XML bit I've extracted from a HTML file in a message I need to pass over to an operation.

I'm doing the following which always errors

classMethod WriteNodes(myfile As %String)
{
Set status=##class(%XML.TextReader).ParseString(myfile,.reader)

....

Any easy way of making this happen?

Kind regards

0 18
1 1.6K

I'm trying to read the response to a long (indefinitely) running HTTP response with Transfer-Encoding: chunked. Ideally I'd be able to read the individual chunks from the response and do something with them as they arrive rather than needing to wait for the response to finish (because it never will) - ultimately I'm thinking to wrap these back up over a WebSocket connection which seems cleaner from an API perspective.

So far it looks like my options are:

1 3
0 668

Looking at the documentation, I see that the global ^ROUTINE brings the information and code of the .INT version of the routines. However, I would like to know where the equivalent information of the .MAC version is, as I did not find any reference to this in the documentation.

Some information in the .MAC version are hidden or already converted into the .INT version, and I would like to have access to this information through the system, and not just opening the routine in the studio.

0 2
0 279

Hey all,

I have been creating a class to handle file encryption by using GPG keys. I pushed my code out today and my encrypt and decrypt methods weren't working. About a half an hour later in troubleshooting I found out that it needed to be a syntax change. My method has three parameters to it. Examples below:

This is how I was calling it in the test system with no issues:

do gpg.Encrypt()

This is how I was having to call it in my production system to work with no issues:

do gpg.Encrypt("","","")

0 6
0 229
Question
· Mar 23, 2023
Saving data into SQL table

Hi Community,

I am trying to save data into SQL table but each entry getting saved twice in the SQL table. Is there any reason data is saving Twice in the SQL table

I have created a %Persistent class for the fields

Please find the business operation below

Class Patient.DBOperation Extends Ens.BusinessOperation

{

Parameter ADAPTER = "EnsLib.SQL.OutboundAdapter";

Property Adapter As EnsLib.SQL.OutboundAdapter;

Parameter INVOCATION = "Queue";

0 6
0 240

I am looking into creating a ZSTOP as you probably have seen from my previous posts, is there a way to capture the type of shutdown that occurred? So say if there was an unknown hardware failure (forced), vs a user shutdown? Mainly looking for user or system shutdown when we force another destination to become the primary in the mirror. So if a user shutdown the production to do.,... Task A, Task B etc..

Thanks

Scott

0 3
0 343
Question
· Mar 7, 2023
Questions about using ZSTOP

I am working on setting up our Failover techniques as we move to a Mirror Environment with a Arbiter, 2 Failover Nodes, and a Async (DR) Node. There are some system commands that I would like to call when the Mirror moves, and I am working on a ZMIRROR routine for that, but I also wanted to create an additional step if we wanted to manually shutdown and for the Mirror to move. So I was looking at using ZSTOP to call a couple of different items while shutting down, while the documentation has an example a couple of questions come to mind about using ZSTOP.

0 3
0 259
Question
· Mar 3, 2023
? %QUERY Wizard in VSCode ?

For my recent tutorial, I used %Query Wizard of Studio.

Could any of the VSCode experts please show me how to generate

Query Statement with input parameters, CONTAINID , ROWSPEC
and the required class methods
- <queryname>Execute()
- <queryname>Fetch()
- <queryname>Close()

I was just not able to do it.
​​​​​​​

3 3
0 163

I'm wondering how I would go about adding headers to a csv file which has already been created. I am unfamiliar with ObjectScript.

For example if I were to use R, I would simply write..

test <- read.csv("file/path/example/Extract.csv", header=FALSE)
colnames(test) <- c("A","B","C","D","E")

I do not have embedded Python installed either as I would know how to do it in that also.

How could I mirror this in ObjectScript please?

My current create file method:

0 3
0 201