go to post Vitaliy Serdtsev · Aug 11, 2023 I didn't find in the documentation the line {InterSystems IRIS ODBC35}: ODBC Connection Strings Test Program Try Driver=InterSystems ODBC Driver;...or DRIVER={InterSystems ODBC35};...
go to post Vitaliy Serdtsev · Aug 11, 2023 Try googling "ssl_error_syscall errno 10053". Perhaps some of the suggestions will help you.
go to post Vitaliy Serdtsev · Aug 11, 2023 It's clearer now, this is the tricks of Excel, which convert the string 01022000 to the number 1022000. In your case, try changing the cell type from General to Text. PS: when generating Excel reports, I use the Date cell type (short format DD.MM.YYYY), and from Caché/IRIS I return the %Date type. The components that I use already know how to translate the internal representation of the date 01.02.2000 from the Caché/IRIS format (58105) to Excel (36557) and vice versa.
go to post Vitaliy Serdtsev · Aug 10, 2023 Can I see how you call TO_CHAR? I have a leading zero displayed without problems: SELECT %internal(to_date('01022000','DDMMYYYY')) -- 01022000 -> 58105 ,TO_CHAR(58105,'DDMMYYYY') -- 58105 -> 01022000TO_CHAR: Convert Dates to Formatted Date Strings
go to post Vitaliy Serdtsev · Aug 10, 2023 Try this: Set objcontato=##class(Contatos.Amiguinho).%New() Do objcontato.MoradiaSetObjectId(3) Do objcontato.TrabalhoSetObjectId(2) Set ret=objcontato.%Save()See Fastest Way to Connect Objects
go to post Vitaliy Serdtsev · Aug 4, 2023 size = 52 ClassMethod IsValid(s As %String) As %Boolean { 1 s c=$a(s,$i(i))+1 g:1-$i(z,c=42-(c=41))&c 1 q 'z }
go to post Vitaliy Serdtsev · Aug 3, 2023 You can make it even easier: ClassMethod IsValid(s As %String) As %Boolean [ Language = python ] { import regex;return regex.match("^((?>[^()]|\((?1)\))*)$",s) is not None }Unfortunately, RegExp ICU does not support recursive patterns, otherwise it would be possible to write q $match(s,"^((?>[^()]|\((?1)\))*)$")
go to post Vitaliy Serdtsev · Aug 3, 2023 No. This code will not work in IRIS 2023.1 because changes have been made for security reasons: Improvements to how IRIS classes are generated and called
go to post Vitaliy Serdtsev · Aug 1, 2023 Thanks for the comment. I tested only on the provided data. The second option requires improvement. size = 72 ClassMethod IsValid(s As %String) As %Boolean { q $l(s,"(")=$l(s,")")&($f(s,"(")<$f(s,")"))&($f(s,")(")-$f(s,"()")<2) } size = 69 ClassMethod IsValid(s As %String) As %Boolean { 1 s c=$i(c,$case($e(s,$i(i)),"(":1,")":-1,"":-2,:0)) q:c<0 c=-2 g 1 }
go to post Vitaliy Serdtsev · Aug 1, 2023 size = 61 ClassMethod IsValid(s As %String) As %Boolean { q +##class(%iFind.Utils).TestSearchString($$$URLENCODE(s)) }
go to post Vitaliy Serdtsev · Aug 1, 2023 It's strange, according to approved method of calculating the length of the solution, your code shows a length of 62, not 61. Have you measured the length of your solution using this method?
go to post Vitaliy Serdtsev · Jul 19, 2023 Query FilterBy( Name As %String = "", Age As %Integer = "") As %SQLQuery(CONTAINID = 1, SELECTMODE = "RUNTIME") [ SqlName = SP_Sample_Filter_By, SqlProc ] { SELECT TOP 5 ID, Name, Age, SSN FROM %ALLINDEX Sample.Person WHERE (:Name IS NULL or Name %STARTSWITH :Name) AND (:Age IS NULL or Age >= :Age) }This kind of query ends up preventing Caché SQL compiler from optimizing using index based on each of the criteria made optional. What is your conclusion based on? If you check the plans of this query for different combinations of parameters, then the corresponding indexes are used (it is assumed that the table was previously configured via TuneTable). select * from Sample.SP_Sample_Filter_By('s') SELECT TOP 5 ID, Name, Age, SSN FROM %ALLINDEX Sample.Person WHERE ('s' IS NULL or Name %STARTSWITH 's') AND (NULL IS NULL or Age >= NULL) select * from Sample.SP_Sample_Filter_By(,47) SELECT TOP 5 ID, Name, Age, SSN FROM %ALLINDEX Sample.Person WHERE (NULL IS NULL or Name %STARTSWITH NULL) AND (47 IS NULL or Age >= 47) select * from Sample.SP_Sample_Filter_By('s',47) SELECT TOP 5 ID, Name, Age, SSN FROM %ALLINDEX Sample.Person WHERE ('s' IS NULL or Name %STARTSWITH 's') AND (47 IS NULL or Age >= 47)
go to post Vitaliy Serdtsev · Jul 19, 2023 Did a little test: Class dc.test [ Abstract ] { ClassMethod GetObjectFieldValue( pObject As %DynamicAbstractObject, pField As %String) As %String { quit:pObject="" "" quit:pField="" "" set tResponse="" set tResponse = pObject.%Get(pField) return tResponse } ClassMethod Test() { s p1={ "priority": "2", "lastmodifieduser": "PORTAL", "assignedto": "jdoe01 STAFF", "status": "REVIEW", "documentclass": "PATIENTCASE", "versiontoken": "937486", "departmentid": "999", "patientcaseid": "105555424", "providerusername": "jdoe01", "internalnote": "firstMessage", "subject": "first123", "patientid": 9877654321, "createduser": "PORTAL", "description": "patient case - first123", "documentroute": "MDP", "documentsubclass": "PATIENTCASE_CLINICALQUESTION", "documentsource": "PORTAL", "createddate": "07/17/2023", "lastmodifieddate": "07/17/2023"} s p2="documentsubclass" w ..GetObjectFieldValue(p1,p2) } }Result: USER>d ##class(dc.test).Test() PATIENTCASE_CLINICALQUESTION
go to post Vitaliy Serdtsev · Jul 4, 2023 Your question has already been answered here: Dynamic SQL and Setting SQLCODE
go to post Vitaliy Serdtsev · Mar 31, 2023 There is nothing specific to IRIS here, except for the connection string. The same code with minimal changes should work with other DBMS: Oracle, SQL Server, PostgreSQL. etc. The Internet is full of examples of how to insert streams into the database via ADO.
go to post Vitaliy Serdtsev · Mar 31, 2023 I wrote a small test on VBS, but you can easily redo this code for your language. For details on working with streams for ADO, see the documentation. Code on Visual Basic Script adVarChar=200 adLongVarChar=201 adLongVarBinary=205 adParamInput=1 adCmdText=1 adExecuteNoRecords=128 Set cn=Createobject("ADODB.Connection") cn.ConnectionString="DRIVER={InterSystems IRIS ODBC35}; SERVER=127.0.0.1; PORT=1972; DATABASE=USER; UID=_system; PWD=SYS;" cn.open Set cmd = Createobject("ADODB.Command") with cmd .ActiveConnection = cn .CommandText = "CREATE TABLE dc.test(Name VARCHAR(50) NOT NULL,Notes TEXT,Photo IMAGE)" .Execute ,,adCmdText + adExecuteNoRecords .CommandText = "insert into dc.test(Name,Notes,Photo)values(?,?,?)" .Parameters.Append .CreateParameter("pName", adVarChar, adParamInput, 50, "blablabla") .Parameters.Append .CreateParameter("pNotes", adLongVarChar, adParamInput, 2147483647, ReadTextFile("C:\bigText.txt","Windows-1251")) .Parameters.Append .CreateParameter("pPhoto", adLongVarBinary, adParamInput, 2147483647, ReadBinaryFile("C:\bigImage.png")) .Execute ,,adCmdText + adExecuteNoRecords end with WScript.Echo "Succesfully!" Function ReadBinaryFile(FileName) Const adTypeBinary = 1 'Create Stream object Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") 'Specify stream type - we want To get binary data. BinaryStream.Type = adTypeBinary 'Open the stream BinaryStream.Open 'Load the file data from disk To stream object BinaryStream.LoadFromFile FileName 'Open the stream And get binary data from the object ReadBinaryFile = BinaryStream.Read End Function Function ReadTextFile(FileName, CharSet) Const adTypeText = 2 'Create Stream object Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") 'Specify stream type - we want To get binary data. BinaryStream.Type = adTypeText 'Specify charset For the source text (unicode) data. If Len(CharSet) > 0 Then BinaryStream.CharSet = CharSet End If 'Open the stream BinaryStream.Open 'Load the file data from disk To stream object BinaryStream.LoadFromFile FileName 'Open the stream And get binary data from the object ReadTextFile = BinaryStream.ReadText End Function
go to post Vitaliy Serdtsev · Mar 9, 2023 In my opinion, the documentation clearly explains the characteristics of such a property and its purpose, for example: To specify that this property has the characteristics of a multidimensional array That is, the property is also automatically Transient. Multidimensional properties are rare but provide a useful way to temporarily contain information about the state of an object.
go to post Vitaliy Serdtsev · Mar 7, 2023 CREATE PROCEDURE DeleteSpecimenTwo (IN Specno VARCHAR(50)) LANGUAGE OBJECTSCRIPT { NEW SQLCODE,%ROWID,%ROWCOUNT #SQLCOMPILE SELECT=LOGICAL &sql(DELETE FROM PCONT WHERE PSPECNO = :Specno) If $Get(%sqlcontext)'=$$$NULLOREF Set %sqlcontext.%SQLCODE=SQLCODE,%sqlcontext.%ROWCOUNT=%ROWCOUNT Quit:SQLCODE<0 &sql(DELETE FROM PSPEC WHERE PSPECNO = :Specno) If $Get(%sqlcontext)'=$$$NULLOREF Set %sqlcontext.%SQLCODE=SQLCODE,%sqlcontext.%ROWCOUNT=%ROWCOUNT }
go to post Vitaliy Serdtsev · Mar 6, 2023 48 (the same example, but with documented feature) ClassMethod Check(w As %String) As %Boolean { f i=1:1:90{ret:$l($$$UPPER(w),$c(i))>2 0} q 1 }