Robert Cemper · Aug 29, 2017 go to post

Sorry, I saw just that one Print method fromSAMPLES.
The redirect is especially required to convert a Write Command to a Write() Method and vice versa.
For "classic" devices as files , TCP, UDP, all kind of pipes ,SPOOL,Console, Teerminal,...all you find in Caché I/O Device Guide I just see no added value  except fiddling around $P which I never had the need to do over 40yrs

Robert Cemper · Aug 29, 2017 go to post
Method PrintPerson()
  {
    set tcp="|TCP|4200"
    open tcp:("127.0.0.1":4200:"PSTE"):1 else  quit
    use tcp
    Write "Name: ", ..Name,!
    close tcp
    Quit  
  }
Robert Cemper · Aug 29, 2017 go to post

you insert the object to itself ????

do context.MainObj.IssuesList.Insert(context.MainObj)

really ? does this make sense ??

I woldd expected something like:

do context.MainObj.IssuesList.Insert( tmpObj )

or

do context.MainObj.IssuesList.Insert(context.tempZenObj )

Robert Cemper · Aug 29, 2017 go to post

The parameters are defined all over here:

 Searching for 'SERVICEINPUTCLASS' in 'Ens*.cls' (whole words,case sensitive)
Ens.Enterprise.MsgBank.BankTCPAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
Ens.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.DICOM.Adapter.TCP.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.EMail.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.File.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.HTTP.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.Pipe.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.SQL.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.TCP.CountedInboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.TCP.DuplexAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.TCP.FramedInboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.TCP.TextLineInboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
EnsLib.UDP.InboundAdapter.cls(SERVICEINPUTCLASS): Parameter SERVICEINPUTCLASS 
Found 13 occurrence/s in 13 file/s.

 Searching for 'SERVICEOUTPUTCLASS' in 'Ens*.cls' (whole words,case sensitive)
Ens.Enterprise.MsgBank.BankTCPAdapter.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
Ens.InboundAdapter.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
EnsLib.DICOM.Adapter.TCP.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
EnsLib.HTTP.InboundAdapter.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
EnsLib.TCP.CountedInboundAdapter.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
EnsLib.TCP.FramedInboundAdapter.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
EnsLib.TCP.TextLineInboundAdapter.cls(SERVICEOUTPUTCLASS): Parameter SERVICEOUTPUTCLASS 
Found 7 occurrence/s in 7 file/s.

But there is no case where it is used.

Looks like "reserved for future use "

Robert Cemper · Aug 29, 2017 go to post

The diagramm shows to me  2 object REFERENCES (oref)
oref consists of a  (local) integer@Classname  and points to an object.
in your case both are of type %Collection.ListOfObj 
by the reference you can't tell that this is the same.
any ##class(%Collection.ListOfObj).%New() will create a new oref
in your case I see a count of 1 and then a count of 2 
you should look what happens in or after (19)  and in or after (29)
looks to me like a fresh return value

Robert Cemper · Aug 28, 2017 go to post

COS shorthand is hard to read in browser;
I personally prefer full size COS + Courier as font.

Robert Cemper · Aug 28, 2017 go to post
set CountRow=pObject.IssuesList.GetAt(i).Count()

you assume pObject.IssuesList.GetAt(i) gives back a %Collection Object (Iist, Array, ..)
Before applying method .Count() you should check if this assumption is true.
your previous description with ASSIGN / APPEND wasn't that convincing that you always have the object you expect.

ref: "out of the scope of ENSEMBLE to an external class" 
you should save anything that you want to keep over that call in one/multiple property of %context Object.
 

Robert Cemper · Aug 28, 2017 go to post

you missed the $TRANSLATE(.....," ",0) around
pls. set the hook to your preferred solution

Robert Cemper · Aug 28, 2017 go to post

$EXCTRACT()  and also $LI(), $Piece()
is not allowed at the left side of SET when the target is an object property

use an intermediate variable instead.

e.g.

set tmp="0000000000"
set $EXTRACT(tmp,10-len(context.PatientID)) = context.PatientID
set context.NewID=tmp

it might be easier that way

set context.NewID=$EXTRACT("0000000000"_context.PatientID,*-9,*)
Robert Cemper · Aug 28, 2017 go to post

Thank you Heikki,
I have passed  this "cooling" too and missed the "heat." So my mind is back and the body stays at home wink 

Robert Cemper · Aug 24, 2017 go to post

Did it work ?

 
 %GCMP
Compares two globals in the same or different namespace.
Robert Cemper · Aug 24, 2017 go to post

Looks like running the query but not getting a resultset.
You seem to be reading past the last row you got.
Hardcore fix, if noting better. Wrap it in Try {  } Catch {}   /// it's not my favourite
 

Robert Cemper · Aug 24, 2017 go to post

Then that's the curse of $PIECE() with no chance to fake it.

So name the separator   # ' " . / \ ~ ^ ...anything but ,

[ as Johnny Cash was singing:  ... anything but "Sue" ]

Robert Cemper · Aug 24, 2017 go to post

I did a short test fiddling arouned ^Samples.PersonI
an to demonstrate the output.

SAMPLES>Do $SYSTEM.OBJ.ValidateIndices("Sample.Person","",1,2)                   
 
Checking index integrity for class 'Sample.Person'
Begin time:  08/17/2017 21:41:25
 
Verifying data from data map 'IDKEY' is indexed correctly...
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CHANG,QUIGLEY H.",39), has differences between master map data and index map data.  Corrected
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CHANG,DAN L.",40) missing.  Corrected
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CHADWICK,OLGA E.",43) missing.  Corrected
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CANNON,BARBARA W.",81) missing.  Corrected
Data Map evaluation complete, 200 rows checked, 4 errors found, elapsed time: .004733 seconds
 
Verifying data from index map "$Person" is correct...
Index map "$Person" evaluation complete, 0 errors, elapsed time: .000691 seconds
 
Verifying data from index map NameIDX is correct...
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CEMPER,DAN L.",40), data differs for field 'Name' between data and index map.  Corrected
Index map NameIDX evaluation complete, 1 errors, elapsed time: .001331 seconds
 
Verifying data from index map SSNKey is correct...
Index map SSNKey evaluation complete, 0 errors, elapsed time: .001195 seconds
 
Verifying data from index map ZipCode is correct...
Index map ZipCode evaluation complete, 0 errors, elapsed time: .001255 seconds
 
%ValidateIndices is complete, total elapsed time: .012282 seconds
 
SAMPLES>

 

This looks good so far.

Robert Cemper · Aug 23, 2017 go to post

to work down a collection of varying number of elements I'd use this kind of loop
in this case it's a double loop

For res=1:1:callresponse.result.Count() {
  Continue:'$IsObject(callresponse.result.GetAt(res)
  For err=1:1:callresponse.result.GetAt(res).Count() {
    Continue:'$IsObject(callresponse.result.GetAt(res).errors.GetAt(err)
    Set context.ErrorMessage= callresponse.result.GetAt(res).errors.GetAt(err).message
    - - - -
    }
 }

This is the paranoic version!
If you trust ENSEMBLE you may skip the check for $IsObject()

HTH

Robert Cemper · Aug 23, 2017 go to post


!   ", "  is seen just as another string text
You need the unicode character here to make it working

columnHeaders="house number"_$C(65292)_" appartment"
Robert Cemper · Aug 23, 2017 go to post


!   ", "  is seen just as another string text
You need the unicode character here to make it working

columnHeaders="house number"_$C(65292)_" appartment"


sorry, was in the wrong context before

Robert Cemper · Aug 21, 2017 go to post

Alexey,

with $ZF(-1,command)  you are at OS level.
Nothing  prevents you from extending command to a script that  writes its pid in a file.
using $JOB_".pid" or similar as file name should be enough to  identify it.
So after a moderate HANG your pid should be available.
I prefer this to using pipes or other sophisticated solutions (e.g. listening on a TCP/IP or UDP port, ...)
as you get  an embedded trace for free  

HTH

Robert Cemper · Aug 21, 2017 go to post

online docs don't give a direct hint.

so my shot from the hip: 
selection expression - $select(), $case()  where you get a value based  on a condition
data expression - anything that sets, modifies, composes data.
this is  a quite academic view since  data expressions may contain selection expressions
and selection expressions may contain data expressions.
both variants and any mix of it  are quite common in COS 

HTH

Robert Cemper · Aug 18, 2017 go to post

Are there also english Versions of those videos ?
My Spanish is rather rusted and more oriented towards holidays.

Robert Cemper · Aug 17, 2017 go to post

I did a short test fiddling arouned ^Samples.PersonI

SAMPLES>Do $SYSTEM.OBJ.ValidateIndices("Sample.Person","",1,2)                   
 
Checking index integrity for class 'Sample.Person'
Begin time:  08/17/2017 21:41:25
 
Verifying data from data map 'IDKEY' is indexed correctly...
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CHANG,QUIGLEY H.",39), has differences between master map data and index map data.  Corrected
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CHANG,DAN L.",40) missing.  Corrected
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CHADWICK,OLGA E.",43) missing.  Corrected
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CANNON,BARBARA W.",81) missing.  Corrected
Data Map evaluation complete, 200 rows checked, 4 errors found, elapsed time: .004733 seconds
 
Verifying data from index map "$Person" is correct...
Index map "$Person" evaluation complete, 0 errors, elapsed time: .000691 seconds
 
Verifying data from index map NameIDX is correct...
Index 'NameIDX', entry ^Sample.PersonI("NameIDX"," CEMPER,DAN L.",40), data differs for field 'Name' between data and index map.  Corrected
Index map NameIDX evaluation complete, 1 errors, elapsed time: .001331 seconds
 
Verifying data from index map SSNKey is correct...
Index map SSNKey evaluation complete, 0 errors, elapsed time: .001195 seconds
 
Verifying data from index map ZipCode is correct...
Index map ZipCode evaluation complete, 0 errors, elapsed time: .001255 seconds
 
%ValidateIndices is complete, total elapsed time: .012282 seconds
 
SAMPLES>

This looks good so far.

Robert Cemper · Aug 17, 2017 go to post

Similar using  Class %System.License. ...  you may reduce the number of allowed connections by USER
This might  be interesting in SaaS situation.

classmethod SetUserLimit(MaxLU As %Integer) as %Integer

$SYSTEM.License.SetUserLimit establishes the maximum number of license units that this Cache instance will consume. This permits a system manager to prevent a Cache instance from consuming all the license units in a MultiServer key shared among multiple Cache instances. The Method returns the former maximum value. In the absence of a call to $SYSTEM.License.SetUserLimit(max) a Cache instance may consume all available license units. 
Requires access to the %Admin Manage resource.