Did you also run a rebuild index ?
Just defining is not enough.
- Log in to post comments
Did you also run a rebuild index ?
Just defining is not enough.
If you use a custom class query %Library.Query type you may write your parameters to some
^mtemp.Evgeny($i(^mtermp.Egeny)) = ..... direct from the Execute method
or ^mtemp.Evgeny($h) = ....
For basic class query %SQL.Query () you may take the usual SQL approach
I refer to this a STATIC clause since it is only executed once by query
because of no reference to any column values
It was my approach to SQL debugging
If your payload is received as a string
set jsn={}.%FromJSON(payload)
write jsn.%Get("boolprop")works without a persistent object
Class MyPackage.MyClass Extends (%Persistent, %JSON.Adaptor)
{
Property JSONid As %Integer(%JSONFIELDNAME = "id");
Property strprop As %String;
Property boolprop As %Boolean;
}
next this worked
set jsn={ "id": 1, "strprop": "string", "boolprop": true }
set sc=obj.%JSONImport(jsn)
zw obj
+----------------- general information ---------------
| oref value: 2
| class name: MyPackage.MyClass
| reference count: 1
+----------------- attribute values ------------------
| %Concurrency = 1 <Set>
| JSONid = 1
| boolprop = 1
| strprop = "string"
+-----------------------------------------------------Probably because extending ObjectScript Functions in %LANGF00.mac is so simple for ages
ZLPAD(%txt,%len,%pad) quit $$lpad^%qarfunc(%txt,%len,%pad)
ZRPAD(%txt,%len,%pad) quit $$rpad^%qarfunc(%txt,%len,%pad)
and then
USER>s txt="robert"
USER>w $zrpad(txt,20,"*")
robert**************
USER>w $zlpad(txt,20,"*")
**************robert$system.SQL.SetIdentityInsert(1) is deprecated and replaced by $system..SQL.Util.SetOption(IdentityInsert ,1)
from class docs:>>>
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25SYSTEM.SQL.Util#METHOD_SetOption
Notes
Sounds good to me
Big THANKS!
A great improvement!
Especially useful for continuous repeating quality checks in OEX !
to be clear:
USEEXTENTSET is great for very large tables where the top (with the ID) is many
storage levels away from data blocks.
It's up to the dimension of your project if the eventual gain in speed pays off at all.
for small tables as we know from our samples, I doubt.
As I expected, it's one of the new storage features that cause the irritation
/// Use hashed global names
Parameter USEEXTENTSET = 1
from docu https://docs.intersystems.com/iris20253/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_storageglobals#GOBJ_storageglobals_hashed
When you set USEEXTENTSET to 1, each index is also assigned to a separate global, instead of using a single index global with different first subscripts. Again, this is done for increased performance.
Not explicitly mentioned - this also affects IDKEY !
And the example presented shows in detail that
IdLocation and DataLocation are NOT identical anymore, as it used to be for decades
You can get the required Global reference like this programmatically:
; get compiled class with your classname
USER>set classname="oex.Dir"
USER>set dic=##class(%Dictionary.CompiledClass).%OpenId(classname)
; get relationship to CompiledStorage
USER>set stor=dic.Storages.GetAt(1)
; get name of the ID-Global
USER>Write stor.IdLocation
^oex.DirD
USER>I'm surprised that data is already imported via SQL but ^myclassD has no content.
So take a look into the related generated class:
Storage Default
{
<Data name="DirDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
- - - - - -
after all properties
</Data>
<DataLocation>^oex.DirD</DataLocation>
<DefaultData>DirDefaultData</DefaultData>
<ExtentSize>986</ExtentSize>
<IdLocation>^oex.DirD</IdLocation>
<IndexLocation>^oex.DirI</IndexLocation>
<IdLocation> is the one to go for
with all the new Storage strategies (columnar, sharded, ... )
This might be quite an exotic global name and rarely the traditional.
I was right.
My 7* review in OEX is still blocked by OEX censors, and your stars are suppressed.
24hrs are promised for reviews in OEX.
Just found it published now [2026-01-04 13:18:45 UTC]
Using methods inside the class instead of
The external MAC routine in the original code is an elegant and valid approach
Happy New Year!
Here is a draft version of ZPretty.mac for ISIS
I'm not sure if this is worth to be public at all.
ZPretty ; make JSON readable
#; input= JSON string
Do(input) public {
if $e(input)="{" do ##class(%JSON.Formatter).%New().Format(input)
else write "<UNDEFINED>"
quit ""
}
tst public ;
set jsn={"Name":"Li,Robert K.","SSN":"672-92-9664","DOB":"1975-01-12","Home":{"Street":"986 Washington Blvd","City":"Boston","State":"PA","Zip":"95802"},"Office":{"Street":"6012 First Place","City":"Reston","State":"MT","Zip":"77739"},"Spouse":{"Name":"Avery,Zelda H.","SSN":"323-13-7437","DOB":"1943-03-27","Home":{"Street":"196 Main Drive","City":"Youngstown","State":"WY","Zip":"53229"},"Office":{"Street":"4056 Franklin Court","City":"Bensonhurst","State":"IA","Zip":"27688"},"FavoriteColors":["Black"],"Age":77},"Age":45,"Title":"Associate Marketing Manager","Salary":10421}
quit jsn In IRiS, instead of ZPretty, you may use this ugly official approach
jsn(jsn)
if $e(jsn)="{" do ##class(%JSON.Formatter).%New().Format(jsn)
else write "<UNDEFINED>"
quitZPretty was initially designed for Caché, Ensemble, ...
ZPretty is not in OEX anymore for various version conflicts
But in IPM you may find this workaround left over.
user>zpm "install pretty-json-upd" For this and other incompatibilities introduced by version changes the
repo on GitHub is broken and not available until several fixes.
Workaround for the left over version is ZPM once again
USER>zpm "install objectscript-native-api"
Studio-2024.1.5.649.0-win.msi is still available from WRC download for contracted customers
It works perfectly for me on IRIS for Windows (x86-64) 2025.1
My guess youw workaroud ERROR 2 cause ERROR 1
ERROR 2:
Your import of the code is just WRONG. Wherever you may have it copied it from
jsn(jsn)
if $e(jsn)="{" write $$Do^ZPretty(jsn)
else write "<UNDEFINED>"
quit }jsn(jsn) is a Label with a parameter
But if your COPY/ TEXT manipulator doesn't understand ObjectScript and
inserts a BLANK before jsn(jsn) , it's no longer a label anymore but just nonsens
therefore :
ERROR: ONAPI.demo.cls(Menu+35) #1026: Invalid command : 'jsn(jsn)' :
Offset:7 [Menu+34^ONAPI.demo.1]
The compiler is right ! Your code is broken
ERROR 1:
now as the label jsn doesn'1 exist anymore, this MUST be an ERROR
if pop do jsn(..iris.ClassMethodValue("ONAPI.Person","JSON",pop))ERROR: ONAPI.demo.cls(Menu+9) #8: <NOLINE> [Menu+8^ONAPI.demo.1]
TEXT: if pop do jsn(..iris.ClassMethodValue("ONAPI.Person","JSON",pop))
The compiler is right again! Your code is broken. The label jsn() is destroyed
In Intersystems ObjectScript blanks and tabs are not just for illustration
or visualization but are an essential part of the language with some functionality.
Somehow like exact indenting in Python, just ~60 years longer
In my Studio such typing errors are flagged red immediately during typing.
So I wonder where the obviously broken source came from and how you worked on it
Merci beaucoup @Thibault Odor d'avoir traduit mon article avec autant d'élégance.
👍
More on the subject Code Scanner & Code Scanner - enhanced
very detailed, very precise. I'm impressed
What you describe is a Basic Class Query. Slightly advanced to embedded SQL
BUT inside a Custom Class Query
https://docs.intersystems.com/supplychain20251/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_queries_userqueries
You have Exec, and Fetch methods.
They can mask whatever you like as long as you feed the formal requirements.
Define the following class methods in the same class:
Where queryname is the name of the query.
Each of these methods accepts an argument (qHandle), which is passed by reference. You can use this argument to pass information among these methods.
So you can mask your DELETE (implemented by embedded SQL) or any other way
It's not the standard way, but nothing prevents you as long as the formalism is served.
You may reduce the number of XDBC connects by 50%
#1)
Create an SQL function for the update
CREATE FUNCTION done_func(integer,varchar) RETURNS integer
AS 'update my_postgres_table set status=$2 where id=$1'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT
RETURN 1 ;#2)
run your SELECT, adding the function in your WHERE clause which is always TRUE
select * from my_postgres_table limit 10000 Where 1 = done_Func(id,'S') You should check the exact syntax for PostgreSQL
I just composed it guided by
https://www.postgresql.org/docs/current/sql-createfunction.html
@Evgeny Shvarov you pointed me to the correct place
Did some checks using the most native approach.
set sc=$system.OBJ.Import(file, . . . . .
Removing the Export Tag from the 2nd line in the 'hidden XML' names DFI
<Export generator="IRIS" version="26" zv="IRIS for Windows (x86-64) 2024.3 (Build 217U)" ts="2025-09-21 16:53:05">
ends with unknown flle type !!!
After re-insert of that Export Tag all import works perfect
might be necessary to teach VScode to add that tag
Interesting observations.
My export came directly out of STUDIO.
InterSystems Studio Client 2024.1.0 Build 262
Server IRIS for Windows (x86-64) 2025.1 (Build 230.2U)
Simple right click + export ..... (+ Windows Directory).
Just straight, no flags, no anything extra
to me *.PKG is imported by $system.OBJ.LoadDir(...) whaever the file name is
one file contained a %ZX.* class.
That one required manual compilation as it didn't match the ZX.* pack
a real class, no DFI
I see.
This didn't happen for me as I just work from Studio
GREAT,
So the DFI worked. I never have touched MAC until now,
Updated init + load + build of cubes
2025....latest had a minor surprise in init
here is it - work in progress ZPM load DFIAnalytics need manual enable, cube to build still manually
BUT:
all DFI are all there (checked with Studio) and working immedeately
Just can confirm that it works for me with a correct structure .../src /DFI /first.DFI /next.DFI /andSoOn.DFI
And in module.xml the relevant part looks like this
<Packaging>module</Packaging> <SourcesRoot>src</SourcesRoot> <Resource Name="DFI.PKG"/>
BINGO