Questions tagged [objectscript]

ObjectScript is a general purpose object-oriented programming language. It is designed to be simple to learn, easy to use, yet still powerful, combining the convenience of an interactive interpreter with many of the features of Java.

ObjectScript is a general purpose object-oriented programming language developed by InterSystems Corporation. It is designed to be simple to learn, easy to use, yet still powerful, combining the convenience of an interactive interpreter with many of the features of Java:

  • a simple java-like syntax
  • class system, with single inheritance and mixins
  • private/protected/public fields and methods
  • exceptions for error handling
  • synchronization and threading
  • compiles to bytecode for higher performance
  • osdoc: a javadoc-like tool to extract API documents
  • from src code, plus API docs accessible reflectively
  • XML-RPC support
  • Windows COM support
  • regular expressions (requires java v1.4 or later)
63 questions
6
votes
3 answers

How to set a variable to NULL in ObjectScript?

In c# I can do: object foo = null; How do I do this in object script?
O.O
  • 11,077
  • 18
  • 94
  • 182
4
votes
3 answers

Compare strings in Intersystems Cache Objectscript

Given: 2 strings strA, strB I want: To perform a comparison between them and return <0, =0 or >0, in Intersystems Cache ObjectScript. So far: I have found a function in the documentation that fulfills my needs StrComp. Unfortunately, this function…
3
votes
1 answer

Unexpected SQL error returns in Intersystems Cache

Problem I'm working on exporting data from an Intersystems Cache database through the Cache ODBC Driver. There is a particular table that is giving me an error message. The ODBC Driver crashes and reports an error from the Cache system. I think I…
3
votes
2 answers

What does this recommendation mean on InterSystem Russia's github coding guidelines (macro)?

These coding guidelines mention (rightfully so, I believe) to "[...]insert spaces after comma in functions/methods argument list". Follows an example, but then this comes after: For obvious reasons this recommendation not applies to arguments in…
fge
  • 119,121
  • 33
  • 254
  • 329
3
votes
1 answer

What is the difference between ByRef and Output method argument modifiers?

All is in the subject, really. I fail to see what the difference in behavior is between those two methods for x: // first version Method m(ByRef x As whatever) { // play with x } // second version Method m(Output x As whatever) { // play…
fge
  • 119,121
  • 33
  • 254
  • 329
3
votes
1 answer

Anyone use SonarCube with ObjectScript

We use InterSystems Cache which has a development language called ObjectScript (kinda looks like VB). It has it's own IDE called Studio. Has anyone been able to successfully use SonarQube with Studio/ObjectScript? There is no plugin for it. Thanks…
3
votes
1 answer

Intersystems cache Object Script pass property as parameter by reference

Given: A class "A" with an %Integer property "intA" A class "B" with a classMethod foo(ByRef num As %integer) that gets a parameter byRef and does some calculations. And knowing that in caché Object Script: If you want to pass a parameter by ref…
3
votes
2 answers

Try-Finally Equivalent in Caché ObjectScript

I'm looking for the equivalent semantics to the popular Try-Finally exception cleanup pattern, e.g. Why use try … finally without a catch clause? The idea is that you have cleanup steps that need to happen regardless of whether the code succeeds or…
Chris Smith
  • 5,326
  • 29
  • 29
3
votes
2 answers

How to use Java Methods with Caché?

I recently read that it is possible to use Java methods in a class by using the language attribute. I tried this: Method JavaTest() As %String [ Language = java, WebMethod ] { string tmp = "Hello World"; return tmp; } The code compiles, but…
O.O
  • 11,077
  • 18
  • 94
  • 182
2
votes
2 answers

How to "throw" a %Status to %ETN?

Many of the Caché API methods return a %Status object which indicates if this is an error. The thing is, when it's an unknown error I don't know how to handle (like a network failure) what I really want to do is "throw" the error so my code stops…
Marc Stober
  • 10,237
  • 3
  • 26
  • 31
2
votes
1 answer

Intersystems Objectscript, Persisted Class with Non Persisted Property

Can we create non persisted property inside persisted class. Simply do not save the property(column) with %Save()
Vivek Ranjan
  • 1,432
  • 2
  • 15
  • 37
2
votes
1 answer

Execute stored functions at run-time

I am trying to retrieve stored functions from a table and have them executed at run-time. Ex MyTableFieldValue contains: $PARAMETER(MyClass,MyParameterName) Where MyTableFieldValue is a field value in a table called MyTable. MyParameterName…
2
votes
1 answer

A property which is Calculated, SqlComputed, with a custom getter, all at the same time: what has the priority?

This is code extracted from this project (note: reformatted for clarity): Class Util.Data.EmojiType Extends %Persistent { Property CodePoint As %Integer; Property UnicodeChar As %String [ Calculated, ReadOnly, SqlComputeCode = { set…
fge
  • 119,121
  • 33
  • 254
  • 329
2
votes
1 answer

What are those elements in the method?

This is an extract of a file from this project (full text here): Method redirects() [ Private, ProcedureBlock = 0 ] { /// Mnemonics APC d APC^%X364 q BEL d BEL^%X364 q CBT(%1) d CBT^%X364(%1) q CCH d CCH^%X364 q CHA(%1) d CHA^%X364(%1) q CHT(%1) d…
fge
  • 119,121
  • 33
  • 254
  • 329
2
votes
1 answer

Updating a form generated by a wizard based on a class

I'm following the tutorial here. I created my data class and added a name property using the wizard. I then created a zen form using the wizard, during which I selected the data class created above. Everything worked great. However, I went back…
1
2 3 4 5