#ObjectScript

0 Followers · 1.5K 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.

Article Can (Jon) Gencler · Nov 8, 2016 5m read
Importance and Collection of Exact Version Information ($zv / $zversion)
 
The explanation of:
- why collecting $zv is important (The WHY),
- what the components of $zv mean (The WHAT),
- and how to collect $zv (The HOW). 
(The Ultimate $zv Guide to the ISC Galaxy in large, friendly letters)
4
1 1667
Question Marc Mundt · Aug 9, 2016

A new Health Connect customer has a few experienced Java folks on their interface team. As they get more into Health Connect and learn Caché ObjectScript they thought it would be useful to have a list of common Java statements with an equivalent statement in ObjectScript. They mentioned string manipulation as an example, but would be interested in other areas as well.
 
This seems like something that is probably already floating around somewhere. Does anyone have something like this or other "COS jumpstart for Java devs" materials?
Thanks,
Marc

1
0 468
Question DQ Hu · Nov 7, 2016

Environment: Cache for Windows (x86-64) 2015.2.2 (Build 811U) Thu Mar 3 2016 12:55:48 EST [HealthShare Modules:Core:14.01.351 

When try the following to send back SOAP Fault, is the following correct way?

Set fault=##class(%SOAP.Fault).%New()
Set fault.faultcode=$$$FAULTServer
Set fault.faultstring="Processing Error"
Set fault.detail= "Error on server"
Do ..ReturnFault(fault)

Got the error 

ERROR #5659: Property '%ZHSLIB.Audit.LogParticipant::Log'
required
1
0 778
Question Laura Cavanaugh · Nov 4, 2016

Here's an easy one for you; before I spend another hour looking for the answer, how do you convert %ArrayOfDataTypes to an array (that could, say, fit into the %session.Data array, or maybe just some array named info()), and of course back again?

NS>s aodt=##class(%ArrayOfDataTypes).%New()
 
NS>w aodt.SetAt("lcavanaugh","username")
1
NS>w aodt.SetAt("organization","coolcompany")
1
NS>w ##class(%ArrayOfDataTypes).BuildValueArray(aodt,.array)
 
<LIST>zBuildValueArray+1^%Library.ArrayOfDataTypes.1

aodt must be serialzed.  What?

NS>zw array

NS>

3
0 1141
Question Sergio Fernandes · Nov 1, 2016

Hi everybody,

My name is Sérgio Fernandes and I'm from Brazil.

I need to get the size of file that the user wants to upload in my application.

I'm getting it name with %request.GetMineData("fileName").FileName, but not found it at Ensemble documentation how would i get the size of file.

My version is Ensemble 2013.1.6.950.0 and I'm doing it at csp.

Thaks 

3
0 843
Question Sabarinathan M · Nov 3, 2016

I try to run the cmd command in the studio terminal, but i am getting the <NOTOPEN> Error.

Even ZF(-1) also not working. Any help, Please!!!

Note: i restart the Cache instance service with full privilege

Code:

Set Path="mkdir E:\Sample\New"

Open Path:"QR":10

Error:<NOTOPEN>

This command working on my PC, but on server throws error.

Many Thanks

3
0 1205
Question Uri Shmueli · Nov 3, 2016

Can somebody explain this behaviour of Cache (and many other calculating machine as well) :

WRITE 1/3*12

4

WRITE 1/3*5

1.666666666666666667

W 1/3*18

5.999999999999999999

W 1/3*21

6.999999999999999999

W 1/3*24

7.999999999999999999

How can we make more occurate caculations in Cache ?

2
0 725
Question Evgeny Shvarov · Oct 28, 2016

There is an interesting discussion in the Russian forum going. 

What is the best solution for the function which returns the max for the set of parameters?

From the listed solutions I like this one:

ClassMethod max(args...) {
  for i=1:1:args {  max(+$g(args(i))) = }
  i=""max=$o(max(i),-1, iQ $lb(maxi)
}
8
0 1043
Article Kyle Baxter · Aug 29, 2016 6m read

This post is the direct result of working with an InterSystems customer who came to me with the following problem:

SELECT COUNT(*) FROM MyCustomTable

Takes 0.005 seconds, total 2300 rows.  However:

SELECT * FROM MyCustomTable

Took minutes.  The reason for this is subtle and interesting enough for me to write a post about.  This post is lengthy, but if you scroll to the bottom I'll write a quick summary, so if you've gotten this far and think you've already read enough, scroll to the end to get the main point.  Check for the sentence in bold.

11
0 1433
Article Jose Ruperez · Oct 13, 2016 1m read

Here you have an easy way to write and execute COS code from your unix scripts. This way one does not need to write routines or even open Studio or Atelier. It can be an option for simple and small actions for instance things like installation tasks or compiling.

See sample bash script (compile.sh) to compile classes:

2
0 968
Question Rustam Ibragimov · Sep 9, 2016

Hello, guys. 

I found one interesting moment in Cache Object Script. It doesn't have(or at least I didn't find) trimming function. By trimming I mean if a string has some whitespaces/tabs/carriage returns from very beginning or/and from very right, this function removes them. 

  I have found several workaround ways. 

1. Using Cache Basic

ClassMethod TrimCacheBasic(str As %String) As %String [ Language = basic ]{Return Trim(str)}

2. Using SQL

6
0 2068
Question Rustam Ibragimov · Sep 17, 2016

Hello, guys.

Say I have two horologs or timestamps, how can I compare them? I know that just time1 > time2 doesn't work because it will compare them as strings which is not correct. 

6
0 3195
Question Neeraj Mehta · Sep 15, 2016

I have been using the query below and it was working fine but now it's giving a SQL error. There were no changes made that could cause this to stop working. There is no Field 'APPLICATIONID' in the table.

QueueSQL=select distinct (convert(char(5),SkillsetID)+'='+Skillset) from iagentbySkillsetStat where ApplicationID > 10000
QueueMappingSQL=SELECT DISTINCT (convert(char(5),SkillsetID)+'='+Skillset), SkillsetID FROM iagentbySkillsetStat iagentbySkillsetStat WHERE (iagentbySkillsetStat.ApplicationID>10000)

DB- Intersystems Cache

Error details for the log files are below.

6
0 4390
Job Digi Thespis · Sep 8, 2016

Wir suchen für ein Unternehmen unserer Firmengruppe

eine/n ERP System Developer / Programmierer/ Software Entwickler

Unser Partnerunternehmen ist ein international agierendes Handelsunternehmen mit Sitz in der Nähe von Wien.

Der zukunftsorientierte IT Bereich entwickelt intelligente innovative Lösungen für die Vielfalt der Herausforderungen, die sich täglich stellen. Die Fülle der abwechslungsreichen Aufgaben und Projekte, sowie die Art und Weise wie zusammengearbeitet wird, bietet hervorragende Wachstums- und Entwicklungschancen.

0
0 658
Question Stephen Wilson · Sep 5, 2016

UPDATE: Found a reason in my code why this could be occurring. Still it would be interesting to hear what people come back with.

Consider the following MERGE statement.

 ^WORKDELETED(DAYNUM,WKS,ACC,$H,%logname)=^WORK(DAYNUM,WKS,ACC)

Produces output

^WORKDELETED(64165,366,16090404088,"64165,34201","user001")="SOME DATA"
^WORKDELETED(64165,366,16090404088,"64165,34201","user001",0,"LOG")="64163*11:05*user001*64163,39919*~"
<other sub-level nodes omitted>

1
0 356
Question David Wright · Aug 29, 2016

I want to use the Regex Matcher to strip HTML tags, but I get a REGEX error. Can anyone explain what I'm doing wrong?

set htmlSnippet = "<h1>Hello</h1>"
set regex = ##class(%Regex.Matcher).%New()
set regex.Text = htmlSnippet
set regex.Pattern = "<[^>]*>"
set plainText = regex.ReplaceAll(" ")
write !,plainText

1
0 1228
Question Nikita Savchenko · Aug 24, 2016

Hello community!

Is there any method/property/way in Caché to obtain something like unique identifier for installed Caché system? The idea is to get the identifier that will differ on any other installation/machine/etc, but will forever remain the same for the current installation, even if $zv changes (in case of update) or any data is removed from the database.

2
0 503
Question Chip Gore · Jun 28, 2016

Hi -

I have 3 classes: "Class A" has a property X, "Class B" has a property which is a Class A, and I have a "Class C" which has a property of a Class B.

Class A definition

Class USER.ClassA Extends %Persistent

{

Property Propx as %String;

}

Class B definition

Class USER.ClassB Extends %Persistent

{

Property Record as USER.ClassA;

}

Class C defintion (which is where I'm having my problem)

Class USER.ClassC Extends %Persistent

{

Property BRecord As USER.ClassB;

Property ARecord As USER.ClassA [ Calculated, SqlComputeCode = { ????? }, SqlComputed ];

Method ARecordGet() as USER.ClassA

{

 quit ..BRecord.ARecord

}

}

5
0 398