Robert Cemper · May 22, 2018 go to post

the dotted syntax works in the same routine as curly braces.
There was a different question recently with such code.

The confusion comes up when you use curly braces INSIDE a dotted section. 
as the nesting is calculated by the dots at the start of the line this causes confusion.  
So cascading and intermixing is a NoNo.

on the other hand 

Do
. line1
. line2
. line3

is an equivalent to 

{
 line1
 line2
 line3
}

-

As dots are always in sequence a move to { } shouldn't be that hard.
Though I admit: It's additional effort

Robert Cemper · May 21, 2018 go to post

It starts with the basic definition:
What is LEGACY for you?  any MUMPS dialect  (DTM. DSM, ISM, ...) ?

From the language elements, there is all included and possible. what was available in MUMPS.
Except that System variables may have some differences that need to be checked.
In general, you have enhancements at all levels: Commands, Functions, Variables

One of the significant differences is variable scoping.
In legacy MUMPS you had your partition and all variables were visible everywhere.
In COS this visibility is managed at various levels and you have to take control over the variable scope.

see this articles:
Variable scope in .mac routine?
Summary on Local Variable Scoping

Of course, interaction with external devices and peripheral is different.
But this doesn't affect programming style.

I assume you have some special techniques in mind.
For questionable cases, this forum is the place to get help at almost any level.
And often it's more than a single unique solution but a choice of variants the members offer.

 I  personally have seen code written on DSM-11 in 1978, copied to Caché and running without change.
This was core logic. Communication with peripherals needed adaption. No surprise.

Robert Cemper · May 21, 2018 go to post

An interesting combination!

But (from Sample.Person):

zNameGetStored(id) public {
Quit $Select(id'="":$listget($g(^Sample.PersonD(id)),2),1:"") }


there isn't that much to win.
If it then ends with %Save() it is kind of a prefetch of the global buffer.

I saw it mostly used instead of  %Open() loading / swizzling the whole object in memory
if just 1 specific property was required.
(A kind of direct global access in disguise) smiley

Robert Cemper · May 21, 2018 go to post

do you have any indication if this is just isModified() 

or if new content is checked against old content

Reason: in past isModified () just checked write access, not the content.
So a change from TRUE to FALSE and back to TRUE between %OpenId()  and %Save() was marked as change (false positive)

so this was finally dropped in favor of GetStored()
 

Robert Cemper · May 21, 2018 go to post

I know of i%PropName

where is  m%PropName documented?

all I found is:

Internally, Caché also uses additional instance variables with names such as r%PropName and m%PropName,
but these are not supported for direct use.

And no hint how they could be used.

Robert Cemper · May 21, 2018 go to post

If you look for a dedicated Property You may use  <propertyname>GetStored(id) to compare against the object in memory

e.g.

set id=22
set old=##class(Sample.Person).SSNGetStored(id)

so you bypass also the case when a value is written back finally unchanged  (false modified)  

Robert Cemper · May 20, 2018 go to post

but I doubt that XML Schema Wizard will do anything useful with a .dtd definition.

Robert Cemper · May 20, 2018 go to post

To use httpS://  in xml schema wizard you need to definde an  SSL configuration in  SMP  System > Security Management > SSL/TLS Configuration.

Robert Cemper · May 20, 2018 go to post

the file comes with the standard Caché /Ensenble distribution kit and should be installed
At least in a UNICODE installation. I verified it for 2016.2 and later.  But it should be here even earlier.

I should add that I have no idea if iths is the right one. It is just the only one for Chinese I know of.
If you miss it you should contact WRC.
 

Robert Cemper · May 19, 2018 go to post

and your class should have class parameter DDL Allowed

Class PCD.NATION  Extends %Persistent [ DdlAllowed ]

Robert Cemper · May 19, 2018 go to post

Ok. this was clear to understand.
You require 2 ALTER TABLE

1) add column N_REGIONKEY2 to 'host' your foreign key

ALTER TABLE PCD.NATION
ADD COLUMN N_REGIONKEY2 INTEGER

2) add foreign key

ALTER TABLE PCD.NATION
ADD CONSTRAINT NATION_FK
FOREIGN KEY (N_REGIONKEY2) REFERENCES TPCD.REGION(R_REGIONKEY);

Robert Cemper · May 18, 2018 go to post

If you remove  port 57772, then HTTP uses default port  80
At that server  your "page" is unknown and you get back 404

I suggest checking the firewalls on your way starting with the server of your public website. to let 57772 in

my 2ct.

Robert Cemper · May 17, 2018 go to post

Hint:
backup of %SYS is good for recovery but not  recommended for a copy
there a lot of instance related settings (e.g. config) included that may cause serious problems in the copy.

Robert Cemper · May 17, 2018 go to post

Online backup can run for exactly selected DBs.
It gives an exact image taking also care for all changes during the backup process.
requirement:
-Journal for the DB must be active at least during the backup process.   
- enough disk space to hold the backup 

Robert Cemper · May 15, 2018 go to post

Jordi,
TSTART, TROLLBACK TCOMMIT is totally unrelated to LOCKing
it neither requests a LOCK nor does it release.

So to have no LOCK at all nothing prevents you from 

TSTART
Do ##class(MyTable).%OpenId(<TableID>, 0)
. . . . .
TROLLBACK 

The short time internal LOCK during %Save() is handled inside Save 

In your example:

TSTART
Lock  +^MyLock
TROLLBACK

you just miss 

Lock  -^MyLock

to unlock your transaction 

Robert Cemper · May 15, 2018 go to post

As there is no further reaction at all I assume this is the summary of the solution:

dynamicObject -> Message to be sent

Property Test as %String (MAXLEN="") ;

Set classObj.Test = DynamicObject.%ToJSON()

 ​Message received -> dynamic Object​

set dynObj={}.%FromJSON(request.Test)
write dynObj.%Get("XYZ")   
Robert Cemper · May 13, 2018 go to post

Just to be complete

Of course at the receiving end 

w request.Test.%Get("XYZ") 

This will fail now with <INVALID OREF>
Since request.Test is now of type %String and not a dynamic object.

You now need to recover your dynamicObject from %String

set dynObj={}.%FromJSON(request.Test)
write dynObj.%Get("XYZ")   




Robert Cemper · May 13, 2018 go to post

Pls. forget "store it as it is" all you store is the oref (a pointer to a local structure) with no persistent storage behind.

set local= dynamicObject.%ToJSON()
set classObj.Test = "my dynamicObject = "_$LENGTH(local)

so you don't get an error if you just apply  %ToJSON()  ???

 If your version is before 2016.2  than .$toJSON() would be the right method

Robert Cemper · May 13, 2018 go to post

You didn't indicate the line you get the error.
anyhow the message is clear:
Either classObj or dynamicObject is not what you expect it to be.
If you test from Terminal you can use

ZWRITE classObj
ZWRITE dynamicObject

to see what they are.

otherwise, you may comment out one line and see if it still breaks e.g.

// set local= dynamicObject.%ToJSON()
set classObj.Test = "my dynamicObject = "_$ISOBJECT(dynamicObject)

So you see what happens.  I expect:  my dynamicObject = 0

So you see where you have to investigate further

Robert Cemper · May 12, 2018 go to post

is it defined that way?
Property Test as %String (MAXLEN="") ;

ATTENTION - default MAXLEN = 50 !!!!!

This might look odd but try

set local= dynamicObject.%ToJSON()
set classObj.Test = local

 
so you see if the issue is your property  
or your dynamic Object. as there are 2 objects in the command.
the only thing %String is checked against is Length. 
otherwise. if %ToJSON() fails your dynamic object is broken somehow