Robert Cemper · Jun 29, 2020 go to post

Is it really %String or a subtype without MAXLEN or MALXEN disabled ?
I have done this in past and I know of some types just defined to remove MAXLEN =50

e.g. %Library.RawString, %Library.Text, ...

Robert Cemper · Jun 29, 2020 go to post

in class %Dictionary.CompiledProperty you have

if  a Property Parameter exists it is in this Array:  
But not all properties have MAXLEN  this is a %String

Robert Cemper · Jun 28, 2020 go to post

If you call routines or classes you should temporarily save your lines before execution
e.g.  ZS temp

Robert Cemper · Jun 28, 2020 go to post

use local routine. like:

a<tab>for i=1:1:100 {
<tab>/// do one line
<tab>///do something else
<tab>}
do a   ;to run it

to edit/show  your line use ZI, ZR, PRINT  

ATTENTION: you need a REAL terminal. 
WebTerm, Studio, .... just can process  single lines as they are only Terminal SIMULATIONS using eXECUTE command

Robert Cemper · Jun 23, 2020 go to post

 I see just nothing in SQL that relates to the error message.
my only wild guess: some NULL value results confuse the VB end.
You could eventually bypass it using NVL() function

SELECT NVL(PROE,'*'),NVL(DESP,'*),NVL(ID,0) FROM ZVBMAPEAMENTO.SVINFOUVND
WHERE JOB=1224 GROUP BY PROE
Robert Cemper · Jun 23, 2020 go to post

The most simple way to do it:
in  class Table.A have 
       Property TableB as Table.B;
in  class Table.B have
                  Property TableA as Table.A;

in your code it may look like this:

set objA=##class(Table.A).%OpenId(212)
set objB=##class(Table.B).%OpenId(99)
set objA.TableB=objB
set objB.TableA=objA
do objA.%Save(), objB.%Save()

You are free to index properties TableA or TableB according to your needs
and you can also use Implicit JOIN between these tables.  

Robert Cemper · Jun 23, 2020 go to post

Suggestion for a calculated Property:

Property SentTimeNEW As Ens.DataType.UTC [ Calculated, SqlComputed,
              
SqlComputeCode = { set {*}=$s({SentTime}<1842:"",1:{SentTime}) } ];
Robert Cemper · Jun 23, 2020 go to post

OK. I understand those records where created BEFORE you defined your new column.
I checked the internal code

$s(%val="":"",1:$zdatetime($zdTH($zdatetimeh(%val,3,,,,,,,,0),-3),3,,3))

This tells me:
- Your value is Not Empty 
- it has no valid time format, so it is trapped by the ERROR option and set to Zero  ==>> 1840-12-31 00:00:00

Suggestion:
- set value to NULL for old records.
or
- create your own data type for this case. 
or

- use a calculated Property  to trap the values

Robert Cemper · Jun 23, 2020 go to post

1840-12-31 00:00:00 is point Zero of internal time setting.
It applies as default to empty data type Ens.DataType.UTC

Robert Cemper · Jun 22, 2020 go to post

embedded SQL is probably an overkill for this formating.
Just convert it to the internal format, add what you need and assemble the pieces in COS

; set datein=201906192359
; set add=60    ;; seconds to add
set dh=$ZDH($e(datein,1,8),8)
set hh=$e(datein,9,10)
set mi=$e(datein,11,12)
set new=$ZTH(hh_":"_mi_":00",3)+add
set zdt=$zdt(new\86400+dh_","_(new#86400),3)
set dateout=$tr($e(zdt,1,*-3),"-: ")
Robert Cemper · Jun 19, 2020 go to post

for the fixed part you still can use classic mapping.
for the variable section you may set   CONTENT = "MIXED"  for the containing property
and get the raw XML structure in hands .
You can then analyze this "inner" XML using class %XML.TestReader

Robert Cemper · Jun 18, 2020 go to post

The example  and the class are simply wrong 
%Library.DynamicObject that is composed here just has neither a method  %Clone nor a method %Compose

You may report the bug to WRC

Robert Cemper · Jun 16, 2020 go to post

Ah, getting closer:
The problem seems to reduce to an alternative way (a wrapper around) to %Open and %Delete. 

Robert Cemper · Jun 16, 2020 go to post

it isn't the save yet. especially if some UNIQUE conflict prevents the save and requires a Rollback
delete isn't affected at all

Robert Cemper · Jun 16, 2020 go to post

As all you need is in %Persitent you could have your own personal.persitent extending %persitent
wrapping %Open and %Delete in your own extended code.
3 points to consider:

  • how to force your personal.persitent to all existent and future classes ?
  • how to force classes generated  by DDL ?
  • how to maintain your extension over release changes ?

Sorry, I doubt if this is the right approach

Robert Cemper · Jun 16, 2020 go to post

take a look at %Library.Persistent. Methods

  • %Open, %OpenId have a 3rd call parameter status  that returns a %Status value indicating success or failure.
  • %Delete, %DeleteId do it as direct result  by a %Status value indicating success or failure.

No further need of an %On.... to know success or failure 

Robert Cemper · Jun 13, 2020 go to post

Allmost!  3rd Update

since if the left side is a Unix Timestamp, then you get this result:

write $zdt($zdth(1591891200000\1000,-2),3) ==> 2020-06-11 18:00:00

docs: https://docs.intersystems.com/iris20201/csp/docbook/Doc.View.cls?KEY=RCOS_fzdatetime 

timezone conversion from UTC may compensate  the 6 hours difference ! 
 in Middle Europ we have we have 2 hrs+  to UTC so

write $zdt($zdt($zdth(1591891200000\1000,-2),-3),3)
2020-06-11 16:00:00