go to post Julius Kavay · Jul 13, 2021 Good Morning Vietnam... ach, I meant Good Morning Julius! After 1977 (the year I first met Mumps) now is the time to learn M the right way and entirely! OK, the truth is, I never usd neither the call nor the expression codemode., hence there was no need to check, how parameter passing works...
go to post Julius Kavay · Jul 13, 2021 Nice solution, but just one question, how gets your S routine the parameter <t>? Is there some trick, I don't know? I would have written this way ClassMethod ToNato(t) [ CodeMode = call ] { ^S(t) } but then makes 5 chars
go to post Julius Kavay · Jul 13, 2021 Oh, believe me, I can top even myself include macrodefs ClassMethod ToNato(t = "If, you can read?" ) [ CodeMode = expression ] { $$$S } ClassMethod s(t) { // whatever solution you have, put it there. } macrodefs.inc #define S ..s(t) Are four chars short enough? Today, I'm just and ish
go to post Julius Kavay · Jul 12, 2021 The possibilities to get a corrupted file are: - you do not read the (Base64) encoded file in chunks of N*4 (where N is an integer)- your stream wasn't rewinded before starting with reading- your (incoming) stream is (already) corrupted (but this would in some cases trigger an error in Base64Decode() method). Just for a test, try this str = is your incoming Base64 stream set filename = "test.tiff" open filename:"nwu":1 if '$test write "Can't open",! quit do str.Rewind() use file while 'str.AtEnd { write $system.Encryption.Base64Decode(str.Read(32000)) } // 32000 = 4 * 8000 close file If the incoming stream is not corruoted, the right now created tiff file should be readable
go to post Julius Kavay · Jul 12, 2021 I bet, this one, with 6 chars only, is shorter ClassMethod ToNato(t = "If, you can read?" ) [ CodeMode = expression ] { ..s(t) } ClassMethod s(t) { // whatever solution you have, put it there. }
go to post Julius Kavay · Jun 21, 2021 I have no idea, what is the date format of PID 7.1, but I'm sure, you can convert this date to $h format, so the answer to your question is set age = $h - $zdh(PID7.1Date,?) \ 365.25 now <age> contains the patients age in full years
go to post Julius Kavay · Jun 10, 2021 Can you please give us an example for (each) those "variantes" (I mean, those JSON strings)?Something like: {"sent":"2021-06-10 09:00:00", "received":"2021-06-10 09:05:00", variante1... } {"sent":"2021-06-10 09:00:00", "received":"2021-06-10 09:05:00", variante2... } Thank you.
go to post Julius Kavay · Jun 9, 2021 If it helped you to understand how things work, then everything is OK. Have a nice day.
go to post Julius Kavay · Jun 8, 2021 Somehow I don't get you right. To save obj.%Size() in a variable, just do a simple assign set myVariable = obj.%Size() but I'm pretty shure, this was not your intended question. I suppose, you have JSON formatted data (a string or a stream) and you want to store those data in a table. Am I right? If yes, then follow the next steps: 1) create a class which describes your JSON objects (strings) Class DC.SehindeRaji Extends (%Persistent, %JSON.Adaptor) { Property byr As %String(%JSONFIELDNAME = "byr:"); Property iyr As %String(%JSONFIELDNAME = "iyr:"); Property eyr As %String(%JSONFIELDNAME = "eyr:"); // do the same for all other fields ClassMethod Import(data) { set obj=..%New() // create a new DC.SehindeRaji object set sts=obj.%JSONImport(data,"") // import the (JSON) data if sts { set sts = obj.%Save() if sts { write "Saved, ID=",obj.%Id(),! quit 1 } else { write "Not saved, Err=",$system.Status.GetOneErrorText(sts),! quit 0 } } else { write "Can't import: ",$system.Status.GetOneErrorText(sts),! quit 0 } } } 2) You can create some test data (interactively) in a terminal session set dynObj = {"byr:":"1937", "iyr:":"2017", "eyr:":"2020"} set data = dynObj.%ToJSON() or get your data somehow from an input (possibly from a file), the only important thing is, your data should look like this write data --> {"byr:":"1937","iyr:":"2017","eyr:":"2020"} 3) import those data write ##class(DC.SehindeRaji).Import(data) --> Saved, ID=1 4) Now open the saved data and check the result set oref = ##class(DC.SehindeRaji).%OpenId(1) write oref.byr --> 1937 write oref.iyr --> 2017 write oref.%JSONExportToString(.exported,"") --> 1 write exported --> {"byr:":"1937","iyr:":"2017","eyr:":"2020"} zw ^DC.SehindeRajiD ^DC.SehindeRajiD=1 ^DC.SehindeRajiD(1)=$lb("","1937","2017","2020") I hope, this is what yoy want to do...
go to post Julius Kavay · Jun 8, 2021 The facts:1) According to the error message: "The system cannot find the file specified."2) Futhermore, the error message shows slashes and backslashes, mixing is rarely good, Windows uses "\", Unix "/" What to do is:1) check the filename, you want to send (including the path)2) check the existence of the file3) Under which user accont is IRIS/Cache running?4) May this user read the file?
go to post Julius Kavay · Jun 8, 2021 It's not clear to me what you want to do. A property like Property MyData as %(Global-or-File)Stream; means, the size of MyData can be something between 0 and the free space on your (hard) drive.That's the reason, why is MyData defined as a stream and not as a %String. On the other hand, in an excel cell you can put no more then 32767 characters, hence the plan to extract those data to an spreadsheet will work only if the MyData properties do not have more then 32767 chars, seehttps://support.microsoft.com/en-us/office/excel-specifications-and-limi... Nevertheless, you could use the following stored procedure to extrac the first 32767 chars from those stream data: Class Your.Table Extends %Persistent { Property StreamData As %GlobalCharacterStream; // other properties ClassMethod StreamDataAsText(ID) As %String [ SqlProc ] { set obj = ..%OpenId(ID,0), text = "" if obj { do obj.StreamData.Rewind() set text obj.StreamData.Read(32767) } quit text } } Now you can get, beside the other data, the first 32767 chars of those stream data too select Your.Table_StreamDataAsText(ID), * from Your.Table
go to post Julius Kavay · Jun 2, 2021 If you can call a JavaScript function, then you could do something like this... <html> <head><title>Test</title> <link id="fav" rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAF0lEQVQokWP8z0AaYCJR/aiGUQ1DSAMAQC4BH5CRCM8AAAAASUVORK5CYII="> <script> function changeFavicon() { var lid=document.getElementById("fav"); if (lid) { lid.setAttribute("href","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAGElEQVQokWNk+M9AEmAiTfmohlENQ0kDAD8vAR+xLJsiAAAAAElFTkSuQmCC"); } } </script> </head> <body> <button onclick="changeFavicon();")>Change my favicon</button><br> </body> </html> The (red and green) icons are just a demo example.
go to post Julius Kavay · May 31, 2021 Oh yes, the idea ... I still have to think about that and get some sleep
go to post Julius Kavay · May 27, 2021 I can't you provide a .Net help but there are methods in IRIS/Cache to create QR code: ##class(%SYS.QRCode).GenerateFile(...) and ##class(%SYS.QRCode).GenerateImage(...) so your developers could have a direct use instead of messing with passing data back and fort between IRIS/Cache and .Net
go to post Julius Kavay · May 27, 2021 The correct timestamp format is YYYY-MM-DD HH:MM:SS but according to the error message, your data does not meets this format. 104 Field validation failed in INSERT, or value failed ...MyTimeStampField' (value '2021-05-26 11:45:40 ') You see the space or tab character after the seconds?
go to post Julius Kavay · May 26, 2021 Yes, use the TRACE utility. See also https://community.intersystems.com/post/macro-know-all-parameters-transf...
go to post Julius Kavay · May 25, 2021 If I got you correctly... for IRIS (and newer Cache Versions) you can use select * from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME='...' and for older Cache versions try select * from %Dictionary.CompiledMethod where SqlProc=1 and Name='...' (but be patient, this takes some time)
go to post Julius Kavay · May 21, 2021 You have a string of digits... like set result="12345678900987654321" then you can easily extract groups of four digits as for i=1:4:$length(result) write $extract(result,i,i+3),! this gives you 1234 5678 9009 8765 4321 assuming, there are no other characters between those numbers...