Robert Cemper · Nov 15, 2017 go to post

A dirty hack:

- make a new class extending %SerialObject with  VALIDIFNULL  set.
- export your serial classes (to XML)
- replace %SerialObject by your MySerialObject
- reload the changed classes.

Not so nice but I had the same issue with some 100 Serial Objects.

The more sophisticated way would be do it programatically over %Dictionary.DefinedProperty  ..... 
Very interesting and very time consuming  

Robert Cemper · Nov 15, 2017 go to post

You have to set $ZTRAP again at the begin:
Or start with do infile^myroutine ....
at the 1. run it is set i line 3
you my also pass the filename as parameter 

Robert Cemper · Nov 15, 2017 go to post

Welcome back!
infile  ; simple file read
  set filename="C\mydir\myfile.txt"
  set $ZTRAP="end"
  open filename:("R"):0 else  Write "file error"
  for line=1:1 use filename read text use 0 write text,! 
end
 close filename
  set $ZTRAP=""
  use 0 write "Done",
  quit

it's not so sophisticated and I used the end-of-file error to exit

This is also available in class %Library.File with lot more comfort 
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?…

HTH
 

Robert Cemper · Nov 15, 2017 go to post

Taskmanager is a part of Caché System Management and you should read the Docs.
JOB is a COS command also used in Taskmanager but not only. Any routine may use it.

So your Request / Question is just not clear
 

Robert Cemper · Nov 15, 2017 go to post

If you don't want / need the content as object and just want to convert XML2JSON
why wasting time and energy to re-invent the wheel an not just using any of the many downloadable tools
and call them over $ZF(-2)  and consume the result ?
Google gave my some thousand hits of tested solutions e.g. https://github.com/sinelaw/xml-to-json

I mean it's doable with Caché but file_in => file_out is not more than a nice exercise for training.
 

Robert Cemper · Nov 15, 2017 go to post

SQL Code and it's style and methodology was there long before Objects in actual style where introduced. (feeling mid 90ties)
It was mainly kept for backward compatibility.
In Caché 5 (2002) they were a real parallel universe  Object - SQL.
Later Computed + SQLcomputed Properties were for long time the only  place for common code.

Robert Cemper · Nov 14, 2017 go to post

Make it a serial class with 2 numeric  properties and a calculated for the difference

Robert Cemper · Nov 13, 2017 go to post

Positive! Confirmed!
If you highjack your previous workspace (as I did by accident) there's nothing to move anymore.
Especially all conections are there already.

Robert Cemper · Nov 13, 2017 go to post

Suggested solution:

#1 create a ROLE with resources DOCBOOK (Readonly) + the required Nmaspaces

#2 remove required resources %Development from web application  /csp/documatic

 #3 next create a user with  the new defined role (here: "docread")

I decided not to give %Development as it could allow access to terminal prompt.

Robert Cemper · Nov 13, 2017 go to post

Thanks, I missed that leaving before yes

And I've seen the new generated code added to  %Save()
It confirmed my feelings about %* ....  smiley

Robert Cemper · Nov 13, 2017 go to post

Thank You Alex!
I knew it's a can of worms and spread over documentation like feeding pigeons.
And honestly I was pretty sure not catch them all and hesitated quite some time to touch it..   
yes  Great contribution.

Robert Cemper · Nov 13, 2017 go to post

%On... callbacks are served and integrated into he OBJECT world and typically don't care about any Trigger.

Triggers live in the SQL TABLE world of your class, with a hand full off %-variables unknown at the Object side
and without an actual instance of object but directly writing to Globals.

Take a look to the generated .INT code of your class and see what you have at hands.
I always found it quite ambitious to attempt a common code of both sides when directly changing Objects or Tables.

Summary:
- for SQL access have Triggers
- for Object access have your %On* methods

Applies only before 2014.1 as pointed out. 
But Trigger code doesn't look much better. 

Robert Cemper · Nov 10, 2017 go to post

something similar:

start ;
 open infile:"R":0 else  write "input file not found",! quit
 open outfile:"WNS":0 else  write "error creating output file",! quit 
 set $Zt="end"
 for line=1:1:5 {
  use infile read sql use 0
  if $e(sql,1,6)'="SELECT" continue
  set rs=##class(%ResultSet).%New()
  set sc=rs.Prepare(sql)
  set:sc sc=rs.Execute()
  if 'sc write "bad SQL statement",! quit
  set cols=rs.GetColumnCount()
  use outfile
;; fill in headers if required
  while rs.Next() {
   for cols=1:1:cols write rs.GetData(cols),$c(9)
   write !
  }
  write !,"###",!
  use 0
 }
 
end set $ZT=""
 close infile,outfile quit
 
!! NOT TESTED !!
Robert Cemper · Nov 10, 2017 go to post

%Save() stream doesn't mean closing.
and Rewind() is different from %Reload().

So the intention of the 3 out-commented lines is not obvious.

Opposite to your comment %Open() does a reload from disk.

Robert Cemper · Nov 8, 2017 go to post

It's available if you update an already existing object.

NOT available for a New or Cloned object

Robert Cemper · Nov 8, 2017 go to post

Do I understand it correctly?

?  Duplicates are allowed but detected.
?  Uniqueness is not forced
Robert Cemper · Nov 7, 2017 go to post

correct.

OVER(PARTITION BY

is an unknown keyword in documentation 
You may need to reformulate your query to achieve a similar result
 

Robert Cemper · Nov 6, 2017 go to post

Sorry, I don't have any Doc reference at hands.
Eventually someone of the Atelier team has.

Out of practical observation
there is a quite fundamental shift in the editing paradigm between Studio and Atelier.

Studio does Server based editing. What you change is there and during your changing session
you lock the Class, Routine, ... So you act as single owner at that time and
anyone else trying to change something gets an immediate alert.  
It's the "Highlander Principle" (according to the film"There can be only One" http://wiki.c2.com/?HighlanderPrinciple
It's based on classical LOCK logic. "Pessimistic Locking"

Atelier acts on your local copy and no one else might know unless you use some source control. !!

At compile time your copy is checked and if it was changed you get a nice Text-Diff to decide how to to proceed.
So we see "Optimistic Locking" or "Versioning".

You can easily reproduce this:
    - open some Class or Routine in Studio and do any change (e.g. Comment) but no compile or save
    - open the same with Atelier. - no alert
    - change it in Atelier. - no alert
    - save it in Atelier. NOW you get your alert from server but you keep your local copy.
    - save your copy in Studio. - you are the winner

next:
    - do some dummy change in Atelier (I found no other way)
    - save it in Atelier and you get the Text-Diff with your version and the actual server version
     but as in past you get no hint how many changes you may have missed.

personal remark:
I think at that point latest anyone should have understood the importance of source control.
to know of an intended change in advance and his history later.