Does anyone have a good example of using
Thanks
Scott
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.
Does anyone have a good example of using
Thanks
Scott
How can I prevent large number truncation when using the DynamicObject and DynamicArray classes to create JSON in objectscript and then parsing the result in javascript. Are there any global settings that configure the output when using these classes?
I am looking at converting to the new DynamicObject and DynamicArray classes to build JSON. Our current (homegrown) JSON library forces string representation of numbers too long because of errors we were seeing with long numbers being truncated on the client, I am hoping to accomplish the same with the new classes.
Using the following...
//Get PDF stream object previously saved
Set pdfStreamContainer = ##Class(Ens.StreamContainer).%OpenId(context.StreamContainerID)
Try {
Set pdfStreamObj = pdfStreamContainer.StreamGet()
}
Catch {
$$$TRACE("Error opening stream object ID = "_context.StreamContainerID)
Quit
}Would it be possible to search the pdfStreamObj for certain values like a Medical Record, or Patient Name?
Thanks
Scott
Hi,
Thanks for your time.
Plain $ZF(-1) and $ZF(-2) calls from Cache Studio or Terminal have stopped launching the OS shell from Win10.
cmd (Windows Command Prompt) should be launched.
Configuration:
Windows 10 Anniversary Update, Ensemble 2016.2.0.585.0 Developer Edition x64
Is this common? I have enabled both %Developer role and a Cache CallOut privilege for all users that operate in this scenario.
In Terminal, W $ZF(-1) prints -1, W $ZF(-2) prints -1
In Studio, W $ZF(-1) hangs the IDE, W $ZF(-2) prints 0
In all four cases, cmd (Windows Command Prompt) is not launched!
Any ideas, anybody?
We don't often use SQL within our org, which is mostly due to the performance issue we experience due to the quantity of data we are reviewing.
Aside from the standard performance measures for non-Caché databases, are there any recommended approaches when querying large tables?
The table would have roughly 50M records, but there are not a finite amount of sub-nodes.
I have a standard text file that is coming out of a system new line delimited. Each document will have the same field structure each time.
ID: xxxxxxxxx Name: xxxx,xxxx Age: xx Sex: x OSU Wexner Medical Center Harding Hospital Treatment at 7/14/2016 10:39:34 AM % Energy Set 50 % Charge Delivered 255.4 mC Current 0.91 A Stimulus Duration 7.0 Sec Frequency 40 Hz Pulse Width 0.
Does anyone have a snippet to create the Namespace and database with defaults in one command?
Something like:
do ##class(Utils.Namespace).Create(Name)Please share?
Thank you in advance!
I am trying to write some code to check to see if a directory exists before creating a new directory.
When I do the following I am not getting a response, but the directory exists..
do ##class(%File).DirectoryExists("/ensemble/")am I missing something?
I would like to integrate SQL into our ObjectScript routines in order to illustrate how SQL can be used to minimize development time. However, there are two questions I have.
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
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 |
| Stack: |
|
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>
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
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
Hello,
I'm sending http request through %Net.HttpRequest and I have html page in response. Is there any built-in tool for beautify html for printing in terminal?
Thanks.
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 ?
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 { s max(+$g(args(i))) = i }
s i="", max=$o(max(i),-1, i) Q $lb(max, i)
}Hi,
I am using iknow text categorization to classify texts. I have 11 medical articles as my training set. Here is part of the source code:
ListerAndLoader
SET domId=domoref.Id
SET flister=##class(%iKnow.Source.File.Lister).%New(domId)
SET myloader=##class(%iKnow.Source.Loader).%New(domId)
UseLister
SET dirpath = "D:\iKnowTestCase\SmallDataBase\Medical"
SET stat = myloader.SetLister(flister)
SET stat = myloader.ProcessList(dirpath,$LB("txt"),0,"")
IF stat '= 1 {WRITE "The lister failed: ",$System.Status.DisplayError(stat) QUIT }
TrainingSet
SET tTrainingSet = ##class(%iKnow.Filters.
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 MyCustomTableTook 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.
I was wondering how you could take an exported obj and have it converted to an int/mac.
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:
#!/bin/bash ##################################################################### # Script to compile classes # $1 = NAMESPACE # $2 = ClassName # # For example: # ./compile.sh "SAMPLES" "Sample.
With a routine like this one, you can quickly calculate how many lines of code you are working with. And it is not only for routines, it works for classes because remember that classes generate routines !
Here you have the routine source code:
LinesOfCode ;
new SQLCODE,tRoutine
set tTotalLOC = 0
&sql(DECLARE ROUTINES CURSOR FOR
SELECT NAME
FROM %Library.RoutineIndex
WHERE TYPE = 'MAC'
ORDER BY NAME)
&sql(OPEN ROUTINES)
&sql(FETCH ROUTINES INTO :tRoutine)
while (SQLCODE=0)
{
write !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
ClassMethod TrimSQL(str As %String) As %String
{
set tStatement = ##class(%SQL.Statement).%New()
set tSC = tStatement.%Prepare("SELECT TRIM(?Have you tried $Translate for date conversion?
USER>write $Translate("Dd.Mm.WwYy","WwYy-Mm-Dd","2015-08-02")
02.08.2015
Stolen from Russian forum and Alexander Koblov.
Hello,
we build a COS-application which includes classmethods for running a simulation calculation (differential equations by Runge Kutta procedure) which runs well but needs too much time. This is embeded in Cache Server Pages and we tried already to start the simulation as a JOB to avoid the CSP-timeout. However the Job needs of course also too much time. May be this could be solved by a different strategy to run the simulation calculation by an external Windows -Programm (developed with Delphi).
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.
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.
14/09/2016 11:20:05 a.m.
What are the difference between $ and $$ symbols using macro.