ObjectScript

Syndicate content 30 

Hello,

I'm using ZEN report to generate a PDF file out a table.

Although, I need to display data from two tables splitted into two different namespaces.

So, I created a process that fetches all the data I need and then calls the PDF class and generates the stream out of it.

 

My question is, once I've got my list of objects. How can I transform it into a ResultSet, in order to display in the report ?

Thanks for your answer.

Last answer 5 March 2019 Last comment 6 March 2019
0   0 4
76

views

0

rating

I successfully got everything in this guide to work:  https://community.intersystems.com/post/ensemble-rabbitmq-java-client-qu...

I am now using the information I gained from this guide along side with this guide:

https://www.rabbitmq.com/tutorials/tutorial-one-spring-amqp.html

 

I am running into an issue though. In the RabbitMQ guide I just posted, they have a "Receive message" functionality. I use that alongside with the SendMsg from Ensemble method in the InterSystems guide. The issue I have is the message I receive looks like "[B@2c421093(byte[21])" instead of "Hello from Ensemble!"

Last answer 4 March 2019 Last comment 5 March 2019
0   0 2
63

views

0

rating

I know it's late, but I really love the advent of code theme each year to find some project ideas to go out and code something and push myself.

I had the intentions of completing the AOC 2018 before the new year, but I've got 2 young kids (1yo and 4yo), so most nights I just want to sleep.

I've been looking at this on my half hourly commute each day before and after work.

So whilst doing this, I found not many people had posted what they had done and in previous years.

I'd found this helpful when I've got stuck for ideas, so I thought I would post what I've done (that works) and see how others might of implemented a solution.

A full explanation of Day1 part 1 can be found at: https://adventofcode.com/2018/day/1 and the input can be found

at: https://adventofcode.com/2018/day/1/input

Last comment 4 March 2019
0   0 2
43

views

0

rating

ˮ This is one of my articles which was never published in English. Let's fix it!

Hello! This article is about quite a practical way of developing InterSystems solutions without using the integrated tools like Studio or Atelier. All the code of the project can be stored in the form of "traditional" source code files, edited in your favorite development environment (for example, Visual Studio Code), indexed by any version control system and arbitrarily combined with many external tools for code analysis, preprocessing, packaging and so on

Last comment 2 March 2019
+ 6   5 3
719

views

+ 6

rating

I have a problem,ExtentSize,Selectivity etc is stored in class definition.

I have multiple namespaces with globals maped and only one class definition for All, for example Orders.

Order definition is only one,mapped to main namespace,but in different namespaces have different ExtentSize etc.

Last answer 1 March 2019 Last comment 2 March 2019
0   0 3
52

views

0

rating

I am taking over a production system that had some HSLIB and other database routine and class files modified. However, I do not know what was modified .

I developed a routine that allows me to load each database in our production instance and compare it against a default instance using the SIZE attribute. This allowed me to generate a list of files where the .INT file size in production does not match the file size in the default instance. However, doing a spot check of the .cls or .mac files indicates that in some cases these files are identical, just the intermediate files are different. 

What I would like to do is export these files (.cls, .int, .mac) to XML, placing the files from production in one folder and the files for the default instance in another. After I can use something like BeyondCompare to better identify what has changed. 

In my code I currently use the following to get information about a routine where p = the name of the routine

Last answer 27 February 2019 Last comment 21 February 2019
0   0 5
128

views

0

rating

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.

Last comment 26 February 2019
+ 15   2 8
1667

views

+ 15

rating

Hello Gentlemen,

 

As you can read on the title, my question is to know how to retranslate the hl7 message into a string and so to remove the '\E' that are inside. A example/picture worth more than a thousand word.

OBX|1|RP|ECG||CARDIO ECG^APPLICATION^PDF^^\E\\E\sitehopital.org\E\files\E\cardio\E\022018\E\GE274583.PDF|

 

As you can see, the escape character \E is used by hl7 message in the purpose to authorize a character '\' just but I don't want it in my program... Is there any function that retranslates this format into a "normal" format?

 

Faithfully,

 

Thomas

Last answer 25 February 2019 Last comment 25 February 2019
0   0 2
78

views

0

rating

I'm getting this compilation error:

Kompilieren der Klasse digi.packet
FEHLER #5002: Caché-Fehler: <FUNCTION>zLockUse+5^%ExtentMgr.GlobalRegistry.1
  > FEHLER #5030: Während der Kompilierung von Klasse 'digi.packet' ist ein Fehler aufgetreten

when importing one of my classes on the production server into one particular namespace

Last answer 22 February 2019 Last comment 24 February 2019
0   0 3
73

views

0

rating

In my routine when I call set filestream.FileName = filename, I get an error

"cn_iptcp://localhost:56773/USER/%Stream.FileBinary.1.INT" does not exist on the Server

I successfully instantiate the %Stream.FileCharacter object. 'filestream' value is '1@%Stream.FileCharacter'. But when I debug the code, the step where I try to set the file name fails. 

The port number for local host looks good for my current instance. I have tried a few variations, such as using the method FileNameSet(). But this did not work either. 

My routine exists in the USER namespace, as indicated in the error. I am very new to Cache and InterSystems, so I could be wrong, but I would expect that my call to instantiate the class would fail if I do not have access to the class property. Yet, the error message seems to indicate that FileBinary intermediate file does not exist in this namespace.

Last answer 23 February 2019 Last comment 22 February 2019
0   0 5
95

views

0

rating

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

Last answer 22 February 2019 Last comment 22 February 2019
0   1 3
124

views

0

rating

Hello gentlemen,

I'm wondering how to get the specific HL7 message structur by coding in ObjectScript. I'm explaining myself, when you receive a hl7 message, you have to set its DocType to be able to read it conveniently. For example, an ADT_A15 (2.3.1) must have the docType of an ADT_A09 (2.3.1) to be well read. So you have 2 possibilities to know that, either you go in the documentation to see which structur to set in but I don't think it's generic.... Either there is a way to code it and to get the correct specific structur and this is why I'm here, if it's possible, how? 

I hope my question is cleared and I'm waiting you gentlemen :-)

Faithfully,

Thomas

Last answer 22 February 2019
0   0 1
0

comments

54

views

0

rating

I am new to Intersystems Cache, so please bear with me. We are using HealthShare 2013.1. 

I have a routine to compare databases from separate instances where I want to ignore values that begin with %sqlcq. I thought this would be easy with pattern matching operator '?' but it is proving difficult and it seems to be because of the percent character. 

For example:

set x = "%sqlcq.something.value.foo"

#;does not evaluate as true. 
if x?1P1"sqlcq" {write "valid"}

set y="sqlcq.something.value.bar"

if y?1"sqlcq".E {write "valid"}
valid
if x?1"sqlcq".E {write "valid"}

  

If the variable value does not include the leading percent character, then I can successfully match. If it does include the percent character then it fails. 

I did try the following pattern, x?1P.1"sqlcq".E and I thought this was successful, but it ended up ignoring %SYS.FOO

What am I missing with pattern matching here? 

Thank you

Last answer 21 February 2019 Last comment 18 February 2019
0   0 4
95

views

0

rating

Our PAS system supplies date in a particular date format (ISO 8601 compliant) that includes seconds and milliseconds.  Because many downstream systems cannot handle milliseconds (and some don't even want seconds) many transformations are required to truncate the data.

What immediately sprang to my mind was to look for a setting on the operation to modify outbound datetime fields - obviously there isn't one, thus the need for this question.  I guess I cold write code to check the schemas for outbound messages and check/replace all the values where the field has a TS type, but my object script skills are basic and I am unsure if I could achieve this (it also seems like I could be adding a big workload to my TIE - especially if my code is not fully optimised).

(I should say this is using Healthshare as  a HL7 based Integration Engine in a UK based NHS hospital

Last answer 18 February 2019 Last comment 18 February 2019
0   0 2
58

views

0

rating

Hello everybody,

My question would be, how is the recommended way to access Windows shares, also in view of future demads. Of course, I'm also happy about an explanation or code snippet of how the library, which is mentioned in the following , can be used under cache.

The classic jcifs library is easy to use, also with Cache, but as microsoft ceases support for smb1, we are currently looking for alternatives. jcifs-ng is such a library, which we took a closer look at. In java code a jcifs-ng file operation looks like this:

[...]
CIFSContext baseCtx = new BaseContext(new PropertyConfiguration(System.getProperties()));
NtlmPasswordAuthenticator creds = new NtlmPasswordAuthenticator(smbDomain,smbUser,smbPass);
CIFSContext ct = baseCtx.withCredentials(creds);
SmbResource sr = ct.get(smbConnect);

// do something with the SmbRessource which can be either a file or a directory
[...

Last comment 12 February 2019
0   0 2
0

answers

74

views

0

rating

Our development server is set up to automatically keep the .INT code of compiled classes and routines, but the live servers are set to not keep the .INT code.

I know how to set the system to keep this code ($SYSTEM.OBJ.SetQualifiers() ?)  but what are the ramifications of keeping this code on the live servers?  Is it just a space issue?  I always thought it was to keep the code more private.

I am just wondering if there's a good reason to keep, or not to keep, the INT code on live servers, since it comes in quite handy at times when needing to debug or even to see certain lines of code that received errors.

Thanks, Laura

Last answer 6 February 2019 Last comment 8 February 2019
0   0 2
223

views

0

rating

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.

For me cosFaker is a populate utils with steroids! You can use together with the Populate, to generate %Stream or long strings, or random Dates.

e.g

Last comment 8 February 2019
+ 8   1 0
539

views

+ 8

rating

Hi,

I'm in the process of trying to convert my team to a Git-based workflow for source code version management (we use Ensemble and HealthShare, but build a lot of customizations on top). We are having a hard time working with Atelier in this regard for a few reasons

Last answer 3 May 2016 Last comment 29 January 2019
+ 2   0 1
961

views

+ 2

rating

Today in docs I found this example using NULL:

 WRITE $LISTVALID($LB(NULL)),!

simplified

zzdump $LB(NULL)

and NULL can be case-insensitive:

zzdump $LB(null)

seems the same as just:

zzdump $LB()

But if null variable is defined then list would contain value from variable. Case sensitive in that situation.

Does anyone have any Idea what is this? Is NULL used anywhere besides as a list element?

Last answer 26 January 2019 Last comment 27 January 2019
0   0 1
111

views

0

rating

Recently I needed a classmethod that returns annotation value based on a name of a activity.

As doing it at runtime seemed inefficient, I wrote compile-time utility that iterates over all business process activities and generates relevant code.

This code could be used in a variety of situations when you need to iterate over business process activities, just add it as a secondary superclass to your BPL processes.

Last comment 27 January 2019
0   0 1
67

views

0

rating

Let Say I have 
Class Carrier Extends %Persistent

Property Employee As Array of Class Employees

Class Employees Extends %SerialObject

Property Name As %String

Property Address As Array of Class AddressDetail

Class AddressDetail Extends %SerialObject

Property Street1 As %String

Property Street2 As %String


I can get value for Employee Name  as Employee_Name.

But I want to Get Value of Address Street1 and Street2 of Class AddressDetail using SQL Query
How can I get that?

Last answer 18 January 2019 Last comment 25 January 2019
0   0 2
125

views

0

rating

I need to automate the handling of usernames passwords, serverNames etc for use in the sending and receiving  of emails, logging into SFTP servers etc etc for use within COS code
To manage external passwords we could use LastPass or any other proprietary password loggers, but I need to be able to call them as part of the automation (COS code) and occasionally visually look them up to "remind" the staff of their passwords.

any suggestions as to the best class data constructs to handle this scenario. Should the whole table be encrypted, only the passwords etc.

each employee has their own login details, past password storage (non-re-use)  could be useful.

we're talking of 200-300+ passwords here.

kevin

Last answer 18 January 2019 Last comment 22 January 2019
0   0 3
184

views

0

rating

Found a strange documentation block about Python bindings in Chapter 3.6 of the Caché manipulation functions with time and date. It looks like this text accidentally copied one to one of the Perl binging documentation. It's funny that the packages of functions called PTIME_STRUCTPtr, PDATE_STRUCTPtr and PTIMESTAMP_STRUCTPtr is suspicious for Python :)  

On the other hand, nothing is said about the functions parse_time, parse_date, parse_timestamp, which are present in /dev/python/intersys/pythonbind.py ahhh!

Has anyone encountered this problem?

Last answer 14 January 2019 Last comment 15 January 2019
+ 2   1 3
133

views

+ 2

rating

This code snippet sends an XML request to a server and saves the response to a file. The class method "test" runs the code:


Class objectscript.postXML
{
    classmethod test() {
        Set HTTPRequest = ##class(%Net.HttpRequest).%New()
        Set HTTPRequest.ContentType = "text/xml"
        Set HTTPRequest.NoDefaultContentCharset = 1
        Set HTTPRequest.Location = "ITOMCZ"
        Set HTTPRequest.Server = "wph.foactive.com"
        Do HTTPRequest.RemoveHeader("User-Agent")  
        Do HTTPRequest.RemoveHeader("Accept-Encoding") 
        Do HTTPRequest.RemoveHeader("Connection")
        Do HTTPRequest.SetHeader("Expect","100-continue")
     
        Set RequestXML = ##class(%Library.File).%New("c:\test.xml")
        Do RequestXML.Open("RS")
        Do HTTPRequest.EntityBody.CopyFrom(RequestXML)
        Do RequestXML.%Close()
     
        Do HTTPRequest.Post(HTTPRequest.Location)
     
        Do $System.OBJ.Dump(HTTPRequest)
        Do $System.OBJ.Dump(HTTPRequest.HttpResponse)
     
        Write HTTPRequest.HttpResponse.Data.Size
        Write HTTPRequest.ContentLength
     
        Set ResponseStream = ##class(%Stream.FileBinary).%New()
        // Second part is typically the file extension, i.e.: application/pdf -> pdf
        Set FileType = $Piece(HTTPRequest.HttpResponse.GetHeader("CONTENT-TYPE"),"/",2)
        Set ResponseStream.Filename = "C:\test."_FileType
     
        Write ResponseStream.CopyFrom(HTTPRequest.HttpResponse.Data)
     
        Write ResponseStream.%Save()
        Do ResponseStream.%Close()
    }
}

Here's a link to the code on GitHub

0   0 2
0

comments

86

views

0

rating

This post is intended to guide you through the new JSON capabilities that we introduced in Caché 2016.1. JSON has emerged to a serialization format used in many places. The web started it, but nowadays it is utilized everywhere. We've got plenty to cover, so let's get started.

Last comment 11 January 2019
+ 32   1 33
6819

views

+ 32

rating

Hello,

I have some beginner questions as I am working through the InterSystems Cache learning path:

- Where I work, we us Cache, but we often learning about and train on MUMPS.  No one really talks about or mentions MUMPS here, but my understanding is that ObjectScript is basically MUMPS plus whatever new things InterSystems put on top of it.  Is that a fair assessment?

- The training online often refers to IRIS.  We don't use IRIS, but we use globals to store data.  I suppose I'm just confused on the difference between Cache, Zen, IRIS and other products as they all seem to do similar things.  

- If I have a global available in a certain namespace, can I use InterSystems SQL to query those globals?  

- How do existing globals and creating classes work?  Like I have a Person global right now.  Can I turn that into a class and manipulate the data that way

Last answer 4 January 2019 Last comment 4 January 2019
0   0 8
255

views

0

rating