Robert Cemper · Mar 29, 2022 go to post

SendRequestSync   is an object method that requires an object as the base.
##class(Ens.BusinessService).SendRequestSync(   works for ClassMethods only.
You need an object instance of Ens.BusinessService to call it.
##class(Ens.BusinessService).%New().SendRequestSync( 
might be a dirty workaround

Robert Cemper · Mar 29, 2022 go to post

just checked %Library.Routine
- a sample of many %R* routines
- lots of @ indirections
- DO with . (dot) syntax
- and of course GOTO.
Just to qualify the code inside.

Robert Cemper · Mar 29, 2022 go to post

I guess all you need is to redirect the ouput of %RCMP  to some %Stream of SPOOL:
In addition, you have %RCMP in your installation and just pick out what you need.

Robert Cemper · Mar 28, 2022 go to post

method FindAt(position As %Integer, target As %CacheString, ByRef tmpstr As %CacheString = "", caseinsensitive As %Boolean = 0) as %Integer

Find the first occurrence of target in the stream starting the search at position. It returns the position at this match starting at the beginning of the stream. If it does not find the target string then return -1. If position=-1 then start searching from the current location and just return the offset from the last search, useful for searching through the entire file. If you are doing this you should pass in tmpstr by reference in every call which is used as a temporary location to store information being read so the next call will start where the last one left off. If you pass caseinsensitive=1 then the search will be case insensitive rather than the default case sensitive search.

Copy to String may help but is limited by MAXSTRING size.
There you may use [  (=contains OPERATOR) or $FIND() function
Don't mix up SQL predicate %CONTAINS  with [  (string contains operator)

  •  
Robert Cemper · Mar 25, 2022 go to post

Enfin la communauté dans la langue de
Robert le Magnifique et son fils Guillaume le Conquérant. !
* * * * *  + + +    * * * * *
smileyyes

Robert Cemper · Mar 24, 2022 go to post
  • That raised the level but was no general solution.
    • As I failed in my Docker container I didn't push it to DemoServer not to break it.
  • Neither Embedded nor (external) Python was able to handle it by standard approach.
  • I did my customized solution to handle any size of JSON file.  

my workaround

Robert Cemper · Mar 23, 2022 go to post

sorry, I have no  idea what  X12 204 EDI is structured. or what you talk about

Robert Cemper · Mar 21, 2022 go to post

I have added a new version  for the GLOBALS contest
To take care of large Globals that may break your available memory.
The JSON Object is exported to a file. and there is also the related loader

New Version 0.1.0

USER>write ##class(dc.GblToJSON.EX).export("^dc.MultiD")
File gbl.json created

And the related loader creates the Global

USER>write ##class(dc.GblToJSON.EX).import()
Global ^dc.MultiD loaded

It is of course also available in the Online Demo facility.  
And to see the generated file there is a show() method

USER>write ##class(dc.GblToJSON.EX).show()
{"gbl":[
{"node":"^dc.MultiD","val":5},
{"node":"^dc.MultiD(1)","val":"$lb(\"Braam,Ted Q.\",51353)"},
{"node":"^dc.MultiD(1,\"mJSON\")","val":"{}"},
{"node":"^dc.MultiD(2)","val":"$lb(\"Klingman,Uma C.\",62459)"},
{"node":"^dc.MultiD(2,2,\"Multi\",\"a\")","val":1},
{"node":"^dc.MultiD(2,2,\"Multi\",\"rob\",1)","val":"rcc"},
{"node":"^dc.MultiD(2,2,\"Multi\",\"rob\",2)","val":2222},
{"node":"^dc.MultiD(2,\"Multi\",\"a\")","val":1},
{"node":"^dc.MultiD(2,\"Multi\",\"rob\",1)","val":"rcc"},
{"node":"^dc.MultiD(2,\"Multi\",\"rob\",2)","val":2222},
{"node":"^dc.MultiD(2,\"mJSON\")","val":"{\"A\":\"ahahah\",\"Rob\":\"VIP\",\"Rob2\":1111,\"Rob3\":true}"},
{"node":"^dc.MultiD(3)","val":"$lb(\"Goldman,Kenny H.\",45831)"},
{"node":"^dc.MultiD(3,\"mJSON\")","val":"{}"},
{"node":"^dc.MultiD(4)","val":"$lb(\"\",\"\")"},
{"node":"^dc.MultiD(4,\"mJSON\")","val":"{\"rcc\":122}"},
{"node":"^dc.MultiD(5)","val":"$lb(\"\",\"\")"},
{"node":"^dc.MultiD(5,\"mJSON\")","val":"{}"}
]}
***** gbl.json *****
Robert Cemper · Mar 21, 2022 go to post

I have added a new version  for the GLOBALS contest
To take care of large Globals that may break your available memory.
The JSON Object is exported to a file. and there is also the related loader

New Version 0.1.2

USER>write ##class(dc.GblToJSON.CX).export("^dc.MultiD")
File gbl.json created

And the related loader creates the Global

USER>write ##class(dc.GblToJSON.CX).import()
Global ^dc.MultiD loaded

It is of course also available in the Online Demo facility.
And to see the generated file there is a show() method

USER>write ##class(dc.GblToJSON.CX).show()
{"gbl":[
"^dc.MultiD=5",
"^dc.MultiD(1)=$lb(\"Braam,Ted Q.\",51353)",
"^dc.MultiD(1,\"mJSON\")=\"{}\"",
"^dc.MultiD(2)=$lb(\"Klingman,Uma C.\",62459)",
"^dc.MultiD(2,2,\"Multi\",\"a\")=1",
"^dc.MultiD(2,2,\"Multi\",\"rob\",1)=\"rcc\"",
"^dc.MultiD(2,2,\"Multi\",\"rob\",2)=2222",
"^dc.MultiD(2,\"Multi\",\"a\")=1",
"^dc.MultiD(2,\"Multi\",\"rob\",1)=\"rcc\"",
"^dc.MultiD(2,\"Multi\",\"rob\",2)=2222",
"^dc.MultiD(2,\"mJSON\")=\"{\"\"A\"\":\"\"ahahah\"\",\"\"Rob\"\":\"\"VIP\"\",\"\"Rob2\"\":1111,\"\"Rob3\"\":true}\"",
"^dc.MultiD(3)=$lb(\"Goldman,Kenny H.\",45831)",
"^dc.MultiD(3,\"mJSON\")=\"{}\"",
"^dc.MultiD(4)=$lb(\"\",\"\")",
"^dc.MultiD(4,\"mJSON\")=\"{\"\"rcc\"\":122}\"",
"^dc.MultiD(5)=$lb(\"\",\"\")",
"^dc.MultiD(5,\"mJSON\")=\"{}\""
]}
***** gbl.json *****
USER>
Robert Cemper · Mar 17, 2022 go to post

Hi @Joel Solon ,  I see it that way:
COS  is aged but was not as short as M (even more aged)
but InterSystemsObjectScript  are 24 Character to type ! 
At least 18+ chances for mistyping with my old fingers. laugh
So I have my personal FLA  (4 letter abbreviation)  to write  "new-speak" and get it sorted right.

Robert Cemper · Mar 15, 2022 go to post

LOAD DATA was released with IRIS 2021.2 and was unknown before
Your version is 2020.1  only.
Sorry

Robert Cemper · Mar 14, 2022 go to post

If your global is part of a class/table class parameter DSTIME could be an approach.
or any SQL trigger or any %OnAfterSave,  %OnAfterDelete, ...
 
For pure Globals all you have is the Journal (if enabled) 

Robert Cemper · Mar 14, 2022 go to post

You may try an external RTF parser to run your conversion  using CPIPE or $ZF(-100-)
and then consume the result. 
1 Example of many others in Google:  striprtf (py) 
Once you move to a version supporting Embedded Python you can run it even internal
 

Robert Cemper · Mar 13, 2022 go to post

OK. after some detailed analysis I found these facts that I forward to WRC:

  • normal JOB command ISOS/COS
    • returns $TEST to signal success/fail
    • $ZC the id of the started job.
    • this happens after complete init of the job or eventually timed
    • is always ASYNCHRONOUS  to the background job
  • JOB command for Embedded Python if not timed
    • Hangs until AFTER completion of the started job
    • then return $TEST and $ZC which is useless as the job is gone!
    • acts SYNCHONOUS to the started job 
  • timed JOB command for Embedded Python
    • returns after the timeout with $TEST = 0  ==> FAILED
    • does not return the id of the started JOB
    • though the started Job may work fine
    • you just don't get info and may find out by other means if it is OK
  • Workaround until a fix.
    • Start a background job as ISOS/COS Class Method
    • let this class method start your method in Embedded Python.

Another reason why Embedded Python Pure is just a fiction

Robert Cemper · Mar 11, 2022 go to post

Hi @Scott.Roth. I'm sure you have access to WRC
under Previews there is a standalone kit Studio-2022.1.0.131.0-win.msi
and it is backward compatible as usual.

Robert Cemper · Mar 7, 2022 go to post

What you see is typical for an inappropriate double encoding.

 
USER>r c
Gômez Jesús María
USER>zzdump c
0000: 47 F4 6D 65 7A 20 4A 65 73 FA 73 20 4D 61 72 ED         Gômez Jesús Marí
0010: 61     
;;; this is already encode in UTF-8 !!!!! 
;;; what you name RAW is already UTF-8 !!!                                                a

USER>s z=$zcvt(c,"O","UTF8")
USER>w z
Gômez Jesús María
;;; now its just broken
USER>zzdump z
0000: 47 C3 B4 6D 65 7A 20 4A 65 73 C3 BA 73 20 4D 61         Gômez Jesús Ma
0010: 72 C3 AD 61                                             ría
USER>
Robert Cemper · Mar 4, 2022 go to post

Hi @Stuart Strickland !

This well-known effect is named Proleptic Gregorian Calendar.
A bunch of other DBs is using it as well. As well as my favorite competitor O*****.
This means it calculates backward as if we always had the Gregorian date since the beginning
and the lost days in  October 1582 and other adjustments are ignored.
In fact, at that time almost every country and smaller had its own calendar. Often like "in the 3rd month of the 7th year of the reign of Duke Goofy 4th".  And converting regional dates from Spain to England or Franc or Italy or Ireland or even Scandinavia is a special mathematical exercise for students of History. On top of that, you often don't have the information if they counted years by Sun calendar or by Moon calendar.
 
 

Robert Cemper · Mar 3, 2022 go to post

from session use the SQL Shell

PROMPT>do $system.SQL.Shell()
SQL Command Line Shell
----------------------------------------------------
The command prefix is currently set to: <<nothing>>.
Enter <command>, 'q' to quit, '?' for help.
[SQL]PROMT>>SELECT whatever single line SQL

or


PROMPT>do $system.SQL.Shell()
SQL Command Line Shell
----------------------------------------------------
 
The command prefix is currently set to: <<nothing>>.
Enter <command>, 'q' to quit, '?' for help.
[SQL]PROMPT>>  << entering multiline statement mode, 'GO' to execute >>
        1>>
Robert Cemper · Mar 1, 2022 go to post

you should check a few things upfront
- is your Caché a 64 bits installation and is the   pythonbind3.c  also compiled for 64 bit   (or both 32bit)
  this might be one possible reason for the "data mismatch" you mention
- pythonbind3.c seems to be a C code using the Callin Interface.
  this requires Service %Service_CallIn to be enabled with user, passwd, ...
- next check the SuperServer Port (default = 1972)
- connect to a USER namespace. Since %SYS requires rather high privileges.
- then check if the connection really works.
  once established it should be possible to identify the related process from
  System Management Portal / Operations / Processes showing the client_exe, namespace, ...
- then you may start composing queries.
 

Robert Cemper · Feb 28, 2022 go to post

it is in Namespace %SYS
Class %CSP.UI.Portal.EnsembleMonitor

if you use a class name starting with %Z* you can even have it in %SYS
 

Robert Cemper · Feb 28, 2022 go to post

A little bit of guessing from my side. behind your page /csp/test/person.csp
there is a namespace  (eg. USER)  with DB user 
If you have no login page you run as "UnknownUser" 
If it has no access rights or appropriate roles (most likely) for this DB behind you are lost;

2 possible workarounds: 

  1. give "UnknownUser"  enough rights for this Namespace and/or DB. 
    • but this is then valid not just to this specific CSP page
    • not really recommendable
  2. create a new user with the required rights
    • on your CSP page you can assign this user undercover by method
    • %CSP.Session.Login() and you have PW under control
    • no need  to touch "UnknownUser"