#ObjectScript

14 Followers · 1.6K Posts

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.

Documentation.

Question Jon Astle · Jun 13, 2019

I am trying to pull the word count from Microsoft Word document into Cache. Is there anyway to get the values of the extended file properties without opening the word document?  If I right click on a word document (Word does not need to be installed) I can see the additional properties that I want to reference however don't know how to access these without calling out to VBA or poweshell.

3
0 466
Question Charles Disksus · Jun 15, 2019

Hi,

I have a project that requires me to post a form.  I am following the documention at https://developers.clicksend.com/docs/http/v2/#send-an-sms .

In code I need to be able to do the following:

https://api-mapper.clicksend.com/http/v2/send.php ? method=http&username=xxxx&key=xxxx&to=+61411111111,+61422222222,+61433333333,+61444444444,+14055555555,+14055555666,+447777777777,+447778888888,+8615555555555&message=This is a test

From within a browser I am getting the expected response.

PS: the numbers I am using a testing numbers: https://developers.clicksend.com/docs/http/v2/#test-sms-numbers

2
0 425
Article Dmitry Maslennikov · Jun 10, 2019 2m read

Hey developers,

I have great news for you. A few days ago, GitHub was updated with the latest version of linguist project, which is being used to recognize source code types in repositories. It helps to determine which programming language had been used in every file of the repository. Repository statistics section shows the results of this module work.

 

Also, you can search across all available GitHub repositories for any chosen language. 

3
1 868
Question Giray Ozel · Jun 6, 2019

Say you have a DICOM document with an input information sequence with many sequence items. You could access every item one by one by looping and querying the path by passing it to the GetValueAt method as demonsrated below.

This works but there are some performance issues on my system if the document has to  be read for each query (as far as I know, that is the case on my system). Is there a way of querying a path, which would return the sequence items as an array? I think I am missing something. With 900 items the process takes around 20 seconds currently.

1
0 315
Announcement Evgeny Shvarov · Jun 9, 2019

Hi Community!

I have very good news for the developers, who are using GitHub to host projects with InterSystems ObjectScript.  GitHub introduced the support of InterSystems ObjectScript this week!

How does it work?

Now all the .cls files in your repository are considered as InterSystems ObjectScript and highlighted according to the language rules of ObjectScript. For example WebTerminal, Samples-Data.

7
1 1135
Article Robert Cemper · Jun 10, 2019 1m read

During testing your code you are often confronted with the need to examine
the actual content of an object. Either using ZWRITE or $system.OBJ.Dump()
you get a picture of simple properties as "--- attribute values ---"
while "--- swizzled references ---" are more confusing than informative
and with "--- calculated references ---" you are just left in the lurch.

This small helper class allows you to dump an object to terminal or
e.g in background to some stream for later review.
By default, you see just properties with content,

   DO ##class(Z.obj).dumpToDevice(obj) 
0
1 1184
Question Paul Riker · Jun 6, 2019

I have a custom process that is parsing HL7 and inserting it into a table. Periodically the inserts fail with # due to error: ERROR #5803: Failed to acquire exclusive lock on instance of.... 

Traditional databases would wait until the lock is removed then do the insert, but cache fails. I'm sure it's my coding approach.

How can I work around this? A Try/Catch loop?

Thanks in advance.

7
0 1099
Question Alex Kogan · Jun 4, 2019

Hello,

I assume there is a simple explanation for this, but I do get <OBJECT DISPATCH> error, when I am trying to set a global to a value.

My example is huge, but I reproduced it using Samples namespace:  

First I delete the Title from ##class(Cinema.Film)  - 3 

Secondly:

SAMPLES>s ref=##class(Cinema.Film).%OpenId(3)
SAMPLES>w ref.Title

SAMPLES>set ^AK(1)=$G(ref.Title)

SET ^AK(1)=$G(ref.Title)
^
<OBJECT DISPATCH> *Property 'Title' in class 'Cinema.Film' must be MultiDimensional

$D also does not work, same error, however this works fine: if ref.Title S ^AK(1)=ref.Title

4
0 1081
Question Vinay Purohit · May 24, 2019

Hello,

I want to search a process ID in Object Script using the reference variable e.g. 1119102928 and kill that process ID. Please guide how it can be achieved.

Thanks in advance.

Vinay Purohit

6
0 578
Article Sergey Kamenev · May 23, 2019 9m read

PHP, from the beginning of its time, is renowned (and criticized) for supporting integration with a lot of libraries, as well as with almost all the DB existing on the market. However, for some mysterious reasons, it did not support hierarchical databases on the globals.

Globals are structures for storing hierarchical information. They are somewhat similar to key-value database with the only difference being that the key can be multi-level:

1
3 1042
Question Stephen De Gabrielle · May 22, 2019

Hi, 

The app of the week is the 'ObjectScript Visual Editor'. 

It looks interesting but the GitHub ownload link[1] given on the InterSystems ObjectScript Visual Editor Open Exchange page[2] fails. 

[1] https://github.com/intersystems-ru/objectscript-visual-editor/releases 

[2] https://openexchange.intersystems.com/package/ObjectScript-Visual-Editor

Does anyone know the github url for download?

@Nikita Savchenko 

4
0 403
Question Jack Smith · May 19, 2019

We have a business service that extends Ens.BusinessService and uses  EnsLib.File.InboundAdapter.

This service polls for json files in a folder.

Method signature is like this:

Method OnProcessInput(pInput As %FileCharacterStream, pOutput As %RegisteredObject) As %Status

And inside that method it tries to read the content like this:

set tData = pInput.ReadLine(,.tStatus, .tEOL)
if ($$$ISERR(tStatus)) quit
set tJSON = {}.%FromJSON(tData)
 

I added some trace calls before and after lines and noticed it's always that last line that fails if content is larger than 32kb.

7
0 589
Question Dave Moss · Jul 18, 2018

Hi All,

Just wondering if anyone had got this working.

In the documentation it says to set the username and password properties of the connection object but these properties don't exist and without authentication I can't connect to the MQ queue.

Any help would be greatly appreciated,

Dave Moss

4
0 427
Question Cole Risch · Apr 10, 2019

First, my $ZVERSION:

Cache for OpenVMS/ALPHA V7.x (Alpha) 2010.1.6 (Build 952_2 + Adhoc 17754) 3-JAN-2018 14:32:54.07

Second, my issue:

I believe my current villain is “incremental compiling.” I was able to compare early compile output with later compile output:

Compilation started on 04/10/2019 10:46:32 with qualifiers 'cuk' Compiling class UnitTests.Task3496 incremental compile detected Compiling routine UnitTests.Task3496.2 Compilation finished successfully in 0.800s.

... several compiles later...

3
0 492
Article Kyle Baxter · Sep 9, 2016 5m read

Have some free text fields in your application that you wish you could search efficiently?  Tried using some methods before but found out that they just cannot match the performance needs of your customers?  Do I have one weird trick that will solve all your problems?  Don’t you already know!?  All I do is bring great solutions to your performance pitfalls!

As usual, if you want the TL;DR (too long; didn’t read) version, skip to the end.  Just know you are hurting my feelings.

11
2 2826
Question David Crawford · May 7, 2019

Hi! I've been fiddling with linked tables to get data from other servers, and I encountered a problem that I'm curious about. Maybe I'm not using these tools as intended or there's more going on, so I'm asking here.

I'm running a query on linked table A, something simple like this:

select name from A where id = 5983658923646

And I get this error:

[SQLCODE: <-400>:<Fatal error occurred>]

  [%msg: <>]

If id, or anything comparison, is something smaller like 4345, it works just fine. It's only when the where reaches a certain length, not just id, that it fails.

6
0 675
Question Amir Samary · May 7, 2019

Hi!

I was trying to create a query that can be exposed as a stored procedure (function actually) that would return a resultset with a random number of columns. 

Unfortunately, it seems that unless I specify the ROWSPEC annotation on the Query method, I won't get any columns exposed. I was hoping to implement QueryNameGetInfo method and specify the names and number of columns I would be returning dynamically. But it seems that GetInfo information is simply ignored.

Here is my code:

5
0 763
Question Dmitry Maslennikov · May 6, 2019

Well, we now have two different platforms Caché and IRIS. With so many changes, that it makes so many difficulties to have the same sources for both platforms. I'm not arguing about the reasons for it. Some of the changes are really reasonable.

It's good when I can import code from Caché to IRIS and get it worked after all background job was done. In Caché we have %CacheStorage type used for Storages. In IRIS it automatically converts to %Storage.Persistent. So, If I develop on IRIS, I will have incompatible sources for Caché.

6
0 613
Question Treephet Phannaphop · May 3, 2019

Hi There

I created function to manage string as requirement  extract the first two letter of each word after space for example:

Text = "Review symptoms to report with patient"

After passed function it will be return "Resytorewipa"

ChangeFormat(desc)

   set desc = "Review symptoms to report with patient"
   q:$g(desc)=""
   SET delim=" "
   SET countdown=$LENGTH(desc,delim)
   set =1
   for
    {
        q:i>countdown
         set abbrv = $e($PIECE(desc,delim,i),1,2)   // But if I put w abbrv  I can get "Resytorewipa"
         set = i+1     
    }
   w abbrv

6
0 601
Question Julie Marulappa · Apr 18, 2019

I am still new to cache objectscript and am trying to figure out how I would go about removing the escape characters from my JSON below. When I call the $toJSON method it's adding the "\" character in the file path.

{"FileStatus":"P","Path":"\/somepath\/test\/test123\/filename.txt","InterchangeOID":"100458"}

My Code:

set tJSONFile = {"FileStatus":pRequest.FileStatus,"Path":pRequest.Path,"InterchangeOID":pRequest.InterchangeOID}

set tJSONFile = tJSONFile.$toJSON()

Thanks.

11
0 10900