Hi,

I have a routing rule that calls some utility classmethods, but for some reason the compiled version insists on linking to a utility function in a different package.

The call to 'SendToEaling(HL7)' in isn't compiling to a call to the LNWTIEPackage as expected:

##class(LNWTIEPackage.RoutingRules.Utility).SendToEaling((pContext.HL7))

but is instead becoming a call to the LNWDeploy package

0 5
1 366
Article
· Sep 6, 2018 1m read
Save a file using %Net.HttpRequest

This code snippet allows for a file on the web to be saved into the file system. Specify the server and GET request, as well as the directory the file should be saved to. The class method "test" runs the code:


Class objectscript.saveFileHTTP Extends %RegisteredObject
{
    classmethod test() {
        Set httprequest = ##class(%Net.HttpRequest).%New()
        Set httprequest.Server = "docs.intersystems.com"
        Do httprequest.Get("documentation/cache/20172/pdfs/GJSON.pdf")
        
        Do $System.OBJ.Dump(httprequest.HttpResponse)
         
        Set stream=##class(%FileBinaryStream).%New()
        Set stream.Filename="c:\test.pdf"

        Write stream.CopyFrom(httprequest.HttpResponse.Data)
        Write stream.%Save()
    }
}

Here's a link to the code on GitHub

3 0
1 920

Hello community!

At the global summit in Phoenix, we (Lite Solutions) will be presenting a tool performing static code analysis on ObjectScript source files. You can see it in action at this URL:

https://demo.cachequality.com

Technically, the tool is a language plugin over SonarQube (http://sonarqube.org) and consists of three main parts:

5 6
1 1.8K

Does anyone have any experience with getting, unfortunately, an older version of Cache to authenticate via SMTP to send email? I have verified that the settings are set up properly on the mailbox as I have successfully sent an email from a LAMP server, which comes from the same IP address.

If you have any thoughts, I would greatly appreciate it.

This is the error I receive

ERROR #6034: SMTP server connection failed during MAIL FROM command: <READ>zSend+105^%Net.SMTP.1.

0 6
0 2.4K

Hello Everyone,

I was wondering about the best way to initialize several variables, or several lists of variables.

Would it be better to write it like:

set (var1, var2, var3) = "value1"
set (var4, var5) = "value2"
set (var6,var7,var8) = "value3"

or

set var1="value1", var2="value1", var3="value1", var4="value2", var5="value2", var6="value3", var7="value3", var8="value3"

or

0 6
0 441

Traditional Caché Objectscript has the multi-dimensional array as its main form of complex data structure and the $order command as the main means of traversing said data structures. But newer versions of Caché ObjectScript also have data structures that are direct parallels of what languages such as JavaScript provide, in the form of %DynamicObject and %DynamicArray. These have an easy to use iterator feature via the %GetIterator method, and even a handy built-in literal syntax for constructing new objects.

0 3
0 932
Announcement
· May 21, 2018
How is your code health

As a developer, usually I'm concerned about how my code health is, and how the other coders code can affect to my own work. And I'm quite sure most of us feel very similar.

In our company we use a Static Code Analysis tool to analyze code for different languages to ensure we are writing high quality and easily maintainable code by following a few best practices in terms of code structure and content. And the question was: why should be different for Caché ObjectScript language?

6 3
4 1.1K

The REST webservice works perfectly when run on SOAP UI. This end point server is an https site that uses basic authentication (uname and pwd). But when I run the request through an Enslib.Rest.Operation using a configured SSL and stored credentials, I get an "unauthorized" error, unless I explicitly hard code the password in the operation class. HS Version is 2014.1 .

I have 2 questions. Pardon me, they are both related!!

0 4
0 1K
Question
· May 6, 2016
Load a dll at run time

I am using java gateway imported/proxy classes and JG business service. I need to load a dll at run time.

I use System.loadLibrary/System.load when in java. I’ve tried $ZF(-3,” C:\Windows\System32\pteidlibj.dll”) and $ZF(-4,1,"C:\Windows\System32\pteidlibj.dll") but I’m getting <DYNAMIC LIBRARY LOAD> error.

How can I load a dll at run time using COS?

0 5
0 1.1K

Hi, Community!

Have a question for general discussion.

In ObjectScript we have cls for classes and mac code, which both compile into int code.

Is there any reason when you use mac instead of cls for non-persistent classes?

For me the benefits for cls are:

1. Inheritance and other OOP features

2. Auto-documented code

For mac one visible benefit is easier call in terminal:

do method^Utils(p1,p2)

vs

1 43
1 2.6K

I have a class that has a property calledTags (like DescriptiveWords, but tags), where multiple tags are possible. I am trying to decide on list of Objects vs. array of Objects.

Based on this post: https://community.intersystems.com/post/querying-list-property-sql, sounds like using an array of Objects is the better way to go. Indeed, I already noticed that it's not possible to have duplicates when using an array of Objects.

0 4
0 806

Hi everyone,

I am still learning the platform for a student project and have to do some streaming and data analysis next. Since for my case I have no "live api" I wanted to just stream json files and output the data as it comes in from the files. (basically to emulate a incoming data scenario)

So thanks to the documentation and community posts I have figured how to create a stream and read data from a JSON but since I'm also new to JSON I have some parsing problems. I don't know how to access subarrays/sub-objects via objectscript.

0 2
0 2.4K

I am working on a TrakCare JIRA issue that requires accessing class properties in a different installation of TrakCare on another machine. For instance, I need to compare the deprecated items in the current version of TrakCare to the deprecated items in a previous release. Is there anything in the built in classes that will allow me to do this, or is it something I'll need to do with a SQL stored procedure or something else I haven't thought of?

0 2
0 272

I am trying to read some binary data from a local file or through socket.

The binary data is like H.264 codec, I need to read data BYTE by BYTE (even BIT by BIT) and decide the next step based on the data read so far.

I check the documentation and it seems like most of the sample focus on human readable IO, ie: LINE by LINE.

Could I achieve my goal through COS?

Thanks.

0 3
0 1.1K

Typically, I have time to review the documentation, which I'm sure is here. However, I have a workaround (TEST1) but I was wondering if anyone could assist me in advising how I would need to adapt the curly brace snippet (TEST2) to provide the same result.

Thanks for any help you can provide.

0 3
0 286

I have a serial object:

Class EmbedObj Extends %SerialObject

which is stored as a property of another object

Class ContainerObj Extends %Persistent

Property InnerObj As EmbedObj;

Property Foobar As %String;

Question:

From within the context of an instance of EmbedObj, how can I navigate to the containing instance of "ContainterObj" and find that value of its Foobar property?

0 8
0 624
Question
· Jun 17, 2018
Connect to hardware

Hello,

If this question is in the wrong section, I apologise.

Has anyone ever used Cache Object Script to connect to any hardware such as a sensor?

What I mean is this :-

Lets assume that code has been written in Cache Object Script where it can detect breaks in electrical connections.

0 2
0 239
Question
· Jun 5, 2018
$CASE For Long Stories

Hi, Community!

$CASE is a fine syntax sugar for "Ifs" with one-line/one-word expressions, like in docs:

SET daynum=$ZDATE($HOROLOG,10)
  WRITE $CASE(daynum,
              1:"Monday",2:"Tuesday",3:"Wednesday",
              4:"Thursday",5:"Friday",
              6:"Saturday",0:"Sunday",:"entry error")

But if my expression for a current case is a multi-line business logic? Can I use "{}" somehow or better go with "IF" instead?

0 13
1 509