go to post Robert Cemper · Nov 2, 2018 GREAT ! all well-documented code!no (dirty) Harry_Potter_Coding !I was sure you know it
go to post Robert Cemper · Nov 1, 2018 The Unix/Linux world often uses LF := $C(10) as line terminatorwhile in Win (and VMS) world CRLF := $C(C13,10) is a default. So you depend on the source system providing the data.Suggested approach: use LF as the (common) line terminator and just drop $C(13) or 
 from your input record by$replace($translate(record,$c(13)),"
","")Before any other processing.
go to post Robert Cemper · Nov 1, 2018 OK, this handles double quotes. But only INSIDE a quoted string parseCSV(string,newsep,sep=",",quote="""",newquote) { ;adjust for flexible quoting set res="",newsep=$g(newsep,$c(9)),newquote=$g(newquote,quote) for { if $g(string)[sep { if $e(string)=quote { set string=$replace(string,"""""",$c(2)) ; exclude double quotes set part=$P(string,quote,2) ,string=$replace($p(string,part_quote_sep,2,*),$c(2),"""""") ,res=res_newquote_$replace(part,$c(2),"""""")_newquote_newsep } else { set part=$P(string,sep),string=$p(string,sep,2,*) ,res=res_part_newsep } } else { set res=res_$g(string) quit } } quit res}-HTH
go to post Robert Cemper · Nov 1, 2018 you are right. I didn't think on empty parts and doubled double quotes which I never met from CSV.next level exercise
go to post Robert Cemper · Nov 1, 2018 I discourage since years the use of $ZU(...) functions as they aren't documented since 2010. I recently had to dig back to 2009 for just a weak hint what might happen.It is even worse with all the internal stuff around %occ* and similar.No docs. No guaranty of the life cycle. No (external) notice of eventual changes. Mostly as a deployed code.If it is used inside a $system.* or part of a generated code that's OK. The responsibility is not at the user side.Verifying those "specials" with every release change can be a very heavy exercise. (just experiencing this on a system locked down to on an older version unable to migrate)
go to post Robert Cemper · Nov 1, 2018 not being verbose in %occ* world I had this solution also allowing to change quoting parseCSV(string,newsep,sep=",",quote="""",newquote) { ;adjust for flexible quoting set res="",newsep=$g(newsep,$c(9)),newquote=$g(newquote,quote) for { if $g(string)[sep { if $e(string)=quote { set part=$P(string,quote,2),string=$p(string,part_quote_sep,2,*) ,res=res_newquote_part_newquote_newsep } else { set part=$P(string,sep),string=$p(string,sep,2,*) ,res=res_part_newsep } } else { set res=res_$g(string) quit } } quit res}BTW.It's an excellent test exercise for new COS programmersI'll add it to my collection.Thanks
go to post Robert Cemper · Oct 29, 2018 Depending on where your output comes from you may trySPOOL - the forgotten deviceorExecute Server Commands from Caché / Ensemble / IRISto get the output into a local variable or global
go to post Robert Cemper · Oct 29, 2018 Congratulations! In past, we had a similar event in Austria named "Tech Talk" that formed a national user community over time.I wish you a lot of success,Robert
go to post Robert Cemper · Oct 21, 2018 OK. for some reason the most important part of the link was truncated.https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25CSP.BinaryStreamI hope it doesn't hide again.The basic mistake happens here the definition of Request https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25CSP.RequestAnd you are right. %CSP.Stream has no Read method because ContentType tells you the true object . As in the example:It could have been %CSP.CharacterStream as well.Both extend over some steps %GlobalStreamAdaptor which have all the READ, WRITE, ....methodsJust reading docs and not checking inherited methods (e.g. in Studio) is mostly misleading.
go to post Robert Cemper · Oct 18, 2018 eventually, EMS might do it.I've just never seen it in action.
go to post Robert Cemper · Oct 18, 2018 Just adding CACHESYS to mirror could be a deadly exerciseWho then is primary? Me or my Mirror?But to achieve your goal you may have an additional DB. Let's name it SYSMIRRORAnd now you use global / subscript level mapping to place the common information there.e.g. ^SYS("Security") or parts of it ("RolesD","UsersD", ..) whatever you think you need.I never tried it but it could not see a contradiction.For better synchronization and uniqueness, I'd personally prefer to have this SYSMIRROR accessed over ECP while holding a local copy of SYSMIRROR for backup / failover
go to post Robert Cemper · Oct 17, 2018 YES it is possible.- see your sub_query first working - just custom_view seems to miss the typical dot in table and view names Views are just a kind of shortcut to a query formula. in namespace SAMPLES you could do thisselect Home_City, DOB, name,(select Name from sample.personview sub where sub.DOB=main.DOB ) SubName from Sample.Person mainThe example doesn't make much sense but it shows that this worksAnyhow, why don't you just use a JOIN like this?select Home_City,main.DOB, main.name, sub.namefrom Sample.Person mainleft outer join sample.personview sub onsub.DOB=main.DOBor in your case select MsgId, FileName, ReportNamefrom main_table LEFT OUTER JOIN custom_viewON MsgId = ReportIdAgain: both table name and view name look odd to me
go to post Robert Cemper · Oct 17, 2018 Hi Sean,somewhat likely, using indirection instead of eXecute set %ref="obj."_prop,key="" for set key=$order(@%ref@(key),1,val) quit:key="" write key,?5,val,!
go to post Robert Cemper · Oct 17, 2018 USER>s x="Керимбай Нурия"USER> w ##class(%CSP.Page).UnescapeHTML(x)Керимбай Нурия
go to post Robert Cemper · Oct 15, 2018 Did you try thishttps://stackoverflow.com/questions/38951794/javascript-string-encoding-windows-1250-to-utf8or this https://www.npmjs.com/package/angular-utf8-base64
go to post Robert Cemper · Oct 12, 2018 It would be useful to have a wider context of your problem. invalid OREF may have many reasons and it's not obvious how this relates to your initial problem
go to post Robert Cemper · Oct 11, 2018 if you do it in object Script you just missed the concatenation operators (Underscore) _ """"_tect_""""