Question
· Aug 3, 2020
INSERT OR UPDATE SQL

Hi, I want to INSERT a customerID and customerName to a table if the customerID does not exist. Or UPDATE if they've changed their name.
I've reviewed the documentation (https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=RS...) and have confused myself with the INSERT OR UPDATE statement. Rather than using two individual statements , is there a way to get it in one?

What I have at the moment doesn't do anything. In fact it errors.

0 3
0 429

Hello,

We would like to learn how would you approach this task.

We would need to check every day a set of folders which are outside our server (in fact we could see them as if they were "inside" the server), then we need to check for modified or created files in the last day, and move all the ones which match the criteria to just one folder in our server.

We have thought about doing the following:

1) Create a task to run it each day:

0 5
0 562

Hello,

We would need to iterate all over the OBXs list and get their OBX3 CE1 to determine if it is the lab result we need to send to the output system.

We wonder how could we achieve this in a foreach component inside a Bussiness Process.

We think we would need to use a foreach because of it is needed to generate a message, for each one of the OBX which have the OBX3 CE1 that the output systems uses for the lab results.

0 1
0 506
Article
· May 1, 2020 1m read
Code sample to concatenate JSON arrays

ObjectScript doesn't include any built-in method for appending one JSON dynamic array to another. Here's a code snippet I use that's equivalent to the JavaScript concat() method.

Call it with any number of arguments to concatenate them into a new array. If an argument is a dynamic array, its elements will be added. Otherwise the argument itself will be added.

5 2
2 651
Question
· Feb 28, 2020
SQLCODE Error -400

I have a code block in a BPL. I have the below SQL and code. All variables have been declared and set. When I run the SQL, if there are no values returned, I get 100 for the value of SQLCODE when I perform the FETCH, which is correct. If values are returned, I get a -400 error when I perform the first FETCH. I've investigated, but cannot find the reason for a -400 error. Hoping someone out here understands this and knows what's wrong.

0 2
0 1.6K

cache 2017.2.1 (Build 801_3)

when I look into the "sql statements" ( sql page of the management portal ) I have lots of old statements with a lot of them frozen. many of them are %sqlcq routines (I believe these are the SLQ's I run when testing/running random SQL queries in the sql page. )

I can clearly see where I can click on an individual query and untick an individual query to unfreeze it. or delete it. but thats a painful slow process. I can't see anywhere to delete/change multiple queries

0 2
0 208
Article
· Dec 12, 2019 2m read
Creating Portlets in DeepSee

What is a portlet?

The simple answer is: a custom widget. A portlet can exist by itself on a DeepSee dashboard, it can be used along side standard DeepSee widgets, or along side other portlets. The rendering of the custom widget is completely user defined. This means you can embed a web page, create a form to perform any sort of action needed based on the data on your dashboard, use third party charting libraries, or simply display data from outside of a DeepSee cube.

How to get started

6 1
0 436

A few years ago, I was teaching the basics of our %UnitTest framework during Caché Foundations class (now called Developing Using InterSystems Objects and SQL). A student asked if it was possible to collect performance statistics while running unit tests. A few weeks later, I added some additional code to the %UnitTest examples to answer this question. I’m finally sharing it on the Community.

5 2
2 563

Hello Everyone,

I'm want to know, what is more common for your company to use, the abbreviation syntax or the complety name of commands, and why?

Ex.

S VAR=10 / D FUNC^ROUTINE F 1:1:1000

Set VAR=10 / Do Func^Routine / For 1:1:1000

set var=10 / do func^routine / for 1:1:1000

Here in my company, we are familiar with the abbreviation syntax, because to spell is more faster.

2 35
0 916

I am reading the following code in ObjectScript:

GitHub repository

And there is a sentence which I am facing difficulties to understand:

kill ^OPNLib.Game.CWLF(..World)

I know that kill removes variables, OPNLib.Game are the package and subpackage, and ..World is a property. However what does CWLF mean?

You could think that it is the class' name, but it is:

0 2
0 177
Question
· Sep 14, 2019
Replacing character groups

What's the best way to replace character groups?

I want not to remove character groups as $zstrip does but to replace them with whitespaces.

$translate needs explicit character list.

Effectively I want to remove any characters besides letters, numbers and a small (known) subset of punctuation characters, replacing everything else with whitespaces.

0 6
0 541
Announcement
· Sep 10, 2019
Code Golf Index

Code golf is a type of recreational computer programming competition in which participants strive to achieve the shortest possible source code that implements a certain algorithm.

Here's a list of Code Golf competitions we had on Developers Community.

And some interesting challenges:

Did I miss something? Add more challenges in comments.

2 0
0 432

Hi Developers!

Often we need to use relatively small arrays with constants, static arrays in algorithms, etc where we need to do something with each element of an array. There are several ways to deal with it in ObjectSctipt.

Previously I used to use globals, locals, PPG for this but not so long time ago figured out that %List is a way too handy.

Indeed, suppose we have an array of months and need to set up and use it in our code.

2 15
1 564
Article
· Aug 1, 2019 3m read
Nested set model for ObjectScript

In many projects I was faced with storing hierarchical data (tree) in classes.
By tree, I mean such data, where each node has a parent node — an object of the same class.
Many examples of such data can be given. For example, a catalog in the online store. Suppose that this online store sells books, in this case, the category tree might look like this:

6 1
1 869
Discussion
· Jul 31, 2019
CodeGolf: FizzBuzz

Let's have a round of CodeGolf!

As usual the goal is to write the shortest solution for a specified problem.

Today we have one of the classics: FizzBuzz.

Write a program that prints the numbers from 1 to 100.

But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”.

For numbers which are multiples of both three and five print “FizzBuzz”

4 22
1 611
Article
· Jul 26, 2019 3m read
Dynamic SQL to Dynamic Object

Hello community! I have to work with queries using all kinds of methods like embedded sql and class queries. But my favorite is dynamic sql, simply because of how easy it is to manipulate them at runtime. The downside to writing a lot of these is the maintenance of the code and interacting with the output in a meaningful way.

7 7
1 901

Hello,

I have a very simple web service that I'd like to secure via SAML Authorization with X.509 Certificates. I am, however struggling with documentation and my lack of cryptographic skills. (I do this just for educational purposes now, but need to use it in the future)

Does anyone have an example that shows how to construct a SOAP Client with adding all necessary security headers manually or point me to a decent learning resource?

Thank you very much!

2 1
2 1.2K

Hi guys!

Portrait of Madame X, Gustave Caillebotte.

One of the features I like in InterSystems ObjectScript is how you can process array transformations in a specific method or a function.

Usually when we say "process an array" we assume a very straightforward algorithm which loops through an array and does something with its entries upon a certain rule.

The trick is how you transfer an array to work with into a function.

One of the nice approaches on how to pass the information about an array is using $Name and Indirection operator.

Below you can find a very simple example which illustrates the thing.

3 2
1 536