go to post José Pereira · Dec 1, 2022 Hi @Thomas Kotze Currently this is not possible. But maybe some changes here may work for your needs. Try to replace the server address. Let me know if it works. Regards, José
go to post José Pereira · Nov 25, 2022 Hi Edmara! Which IRIS version are you trying? I did a test using the version "IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.2 (Build 368U) Fri Oct 21 2022 17:18:04 EDT" and all worked fine. Please, checkout the example below on your IRIS version. It shows the index global value (^dado.TblTesteI) in order to get more visibility of what is going on. dado.TblTeste: Spoiler Class dado.TblTeste Extends (%Persistent, %Populate) { Index idxFieldOneFieldTwoFieldThree On (FieldOneId, FieldTwoId, FieldThreeId) [ Unique ]; ForeignKey fkFieldOneId(FieldOneId) References dado.TblFieldOne(); ForeignKey fkFieldTwoId(FieldTwoId) References dado.TblFieldTwo(); ForeignKey fkFieldThreeId(FieldThreeId) References dado.TblFieldThree(); Property FieldOneId As dado.TblFieldOne [ Required ]; Property FieldTwoId As dado.TblFieldTwo [ Required ]; Property FieldThreeId As dado.TblFieldThree; Property Descricao As %String [ Required ]; Property VersaoCheck As %String [ InitialExpression = 0 ]; ClassMethod OpenCompositeIndexTest() { // IRIS version Write "IRIS version: ", $ZV,! // clean up tables Write !,"Cleaning up tables..." $$$TOE(st, ##class(dado.TblTeste).%KillExtent()) $$$TOE(st, ##class(dado.TblFieldOne).%KillExtent()) $$$TOE(st, ##class(dado.TblFieldTwo).%KillExtent()) $$$TOE(st, ##class(dado.TblFieldThree).%KillExtent()) // populate dependencies Write !,"Populating tables..." $$$TOE(st, ##class(dado.TblFieldOne).Populate()) $$$TOE(st, ##class(dado.TblFieldTwo).Populate()) $$$TOE(st, ##class(dado.TblFieldThree).Populate()) Write ! // test with value for all index fields Set testDesc = "Test with FieldThreeId using SQL DML" Write !,"---",!,testDesc_":" &SQL(insert into dado.TblTeste (FieldOneId, FieldTwoId, FieldThreeId, Descricao) values (1, 2, 3, :testDesc)) If SQLCODE < 0 {Write !,"SQLCODE error ", SQLCODE, " ", %msg} Set object = ##class(dado.TblTeste).idxFieldOneFieldTwoFieldThreeOpen(1, 2, 3) If 'object {Do $system.OBJ.DisplayError()} Else {Write !,"Ok"} Write !,"Index global: ",! ZWrite ^dado.TblTesteI // test with no value for field FieldThreeId and insertion via SQL DML Set testDesc = "Test with no FieldThreeId using SQL DML" Write !,"---",!,testDesc_":" &SQL(insert into dado.TblTeste (FieldOneId, FieldTwoId, FieldThreeId, Descricao) values (1, 2, null, :testDesc)) If SQLCODE < 0 {Write !,"SQLCODE error ", SQLCODE, " ", %msg} Set object = ##class(dado.TblTeste).idxFieldOneFieldTwoFieldThreeOpen(1, 2, "") If 'object {Do $system.OBJ.DisplayError()} Else {Write !,"Ok"} Write !,"Index global: ",! ZWrite ^dado.TblTesteI // test with no value for field FieldThreeId and insertion via object interface Set testDesc = "Test with no FieldThreeId using object" Write !,"---",!,testDesc_":" Set o = ##class(dado.TblTeste).%New() Do o.FieldOneIdSetObjectId(2) Do o.FieldTwoIdSetObjectId(1) Set o.Descricao = testDesc $$$TOE(st, o.%Save()) Set object = ##class(dado.TblTeste).idxFieldOneFieldTwoFieldThreeOpen(2, 1, "") If 'object {Do $system.OBJ.DisplayError()} Else {Write !,"Ok"} Write !,"Index global: ",! ZWrite ^dado.TblTesteI } Storage Default { <Data name="TblTesteDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> <Value name="2"> <Value>FieldOneId</Value> </Value> <Value name="3"> <Value>FieldTwoId</Value> </Value> <Value name="4"> <Value>FieldThreeId</Value> </Value> <Value name="5"> <Value>Descricao</Value> </Value> <Value name="6"> <Value>VersaoCheck</Value> </Value> </Data> <DataLocation>^dado.TblTesteD</DataLocation> <DefaultData>TblTesteDefaultData</DefaultData> <IdLocation>^dado.TblTesteD</IdLocation> <IndexLocation>^dado.TblTesteI</IndexLocation> <StreamLocation>^dado.TblTesteS</StreamLocation> <Type>%Storage.Persistent</Type> } } dado.TblFieldOne: Spoiler Class dado.TblFieldOne Extends (%Persistent, %Populate) { Property FieldOneId As %Integer [ Required ]; Property FieldOneText As %String [ Required ]; Storage Default { <Data name="TblFieldOneDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> <Value name="2"> <Value>FieldOneId</Value> </Value> <Value name="3"> <Value>FieldOneText</Value> </Value> </Data> <DataLocation>^dado.TblFieldOneD</DataLocation> <DefaultData>TblFieldOneDefaultData</DefaultData> <IdLocation>^dado.TblFieldOneD</IdLocation> <IndexLocation>^dado.TblFieldOneI</IndexLocation> <StreamLocation>^dado.TblFieldOneS</StreamLocation> <Type>%Storage.Persistent</Type> } } dado.TblFieldTwo: Spoiler Class dado.TblFieldTwo Extends (%Persistent, %Populate) { Property FieldTwoId As %Integer [ Required ]; Property FieldTwoText As %String [ Required ]; Storage Default { <Data name="TblFieldTwoDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> <Value name="2"> <Value>FieldTwoId</Value> </Value> <Value name="3"> <Value>FieldTwoText</Value> </Value> </Data> <DataLocation>^dado.TblFieldTwoD</DataLocation> <DefaultData>TblFieldTwoDefaultData</DefaultData> <IdLocation>^dado.TblFieldTwoD</IdLocation> <IndexLocation>^dado.TblFieldTwoI</IndexLocation> <StreamLocation>^dado.TblFieldTwoS</StreamLocation> <Type>%Storage.Persistent</Type> } } dado.TblFieldThree: Spoiler Class dado.TblFieldThree Extends (%Persistent, %Populate) { Property FieldThreeId As %Integer [ Required ]; Property FieldThreeText As %String [ Required ]; Storage Default { <Data name="TblFieldThreeDefaultData"> <Value name="1"> <Value>%%CLASSNAME</Value> </Value> <Value name="2"> <Value>FieldThreeId</Value> </Value> <Value name="3"> <Value>FieldThreeText</Value> </Value> </Data> <DataLocation>^dado.TblFieldThreeD</DataLocation> <DefaultData>TblFieldThreeDefaultData</DefaultData> <IdLocation>^dado.TblFieldThreeD</IdLocation> <IndexLocation>^dado.TblFieldThreeI</IndexLocation> <StreamLocation>^dado.TblFieldThreeS</StreamLocation> <Type>%Storage.Persistent</Type> } } Output of OpenCompositeIndexTest() method: IRISAPP>d ##class(dado.TblTeste).OpenCompositeIndexTest()IRIS version: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.2 (Build 368U) Fri Oct 21 2022 17:18:04 EDT Cleaning up tables...Populating tables... ---Test with FieldThreeId using SQL DML:OkIndex global: ^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,3,1)="" ---Test with no FieldThreeId using SQL DML:OkIndex global: ^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,-100000000000000,2)=""^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,3,1)="" ---Test with no FieldThreeId using object:OkIndex global: ^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,-100000000000000,2)=""^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,3,1)=""^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",2,1,-100000000000000,3)="" HTH, José
go to post José Pereira · Nov 2, 2022 Hi @Evgeny Shvarov ! I've create the module.xml but forgot to publish it to OEX... Done: https://openexchange.intersystems.com/portal/package/iris-grpc-example Thank you for letting me know!
go to post José Pereira · Nov 2, 2022 Also there are a plenty of examples in OpenExchange, which you can try via ZPM (IRIS package manager): https://openexchange.intersystems.com/?search=REST&sort=d.desc
go to post José Pereira · Apr 7, 2022 Hi guys! Could you please add the 1st article bonus for python-globals-serializer-example? Article: https://community.intersystems.com/post/serializing-python-objects-globals Thanks!
go to post José Pereira · Apr 7, 2022 Hi Vitaliy, Thank you for that valuable information! I'll take it into account. But let's assume that I do a partial rebuild. Is it OK to use this partially rebuilt index if I don't care about data that isn't indexed? Did you do this before? Thanks
go to post José Pereira · Feb 28, 2022 Hi! Please, checkout this post: https://community.intersystems.com/node/498271 HTH
go to post José Pereira · Feb 28, 2022 Really nice apps in this contest, I'm learning a lot! Congrats to all participants!
go to post José Pereira · Feb 8, 2022 @Henrique Dias True story! And let's go 2022! Congratulations community!
go to post José Pereira · Jan 14, 2022 Hi @Ben Spead! Thank you for warning me! :) Fixed! I usually double check my English writings in text editors like Google Docs, but I missed to check the title... A little explanation here, I'm Brazilian, so a Portuguese native speaker. But it's OK, Portuguese is a kind of brother of Spanish! =)
go to post José Pereira · Jan 7, 2022 For those who are looking for unziping features, Embedded Python (for IRIS 2021.2+) allows you to use zipfile Python lib. For instance: ClassMethod UnZip(pZipFileName As %String, pExtractToDir As %String) [ Language = python ] { #; solution based on this one: https://stackoverflow.com/a/3451150/345422 import zipfile with zipfile.ZipFile(pZipFileName, 'r') as zip_ref: zip_ref.extractall(pExtractToDir) } Or ClassMethod UnZip2(pZipFileName As %String, pExtractToDir As %String) { Set zipfile = $SYSTEM.Python.Import("zipfile") Do zipfile.ZipFile(pZipFileName, "r").extractall(pExtractToDir) } Tested on iris-ml-community:2021.2.0.617.0-zpm
go to post José Pereira · Dec 28, 2021 Hi! Thanks for your code, but I tried it and can't get a file in the directory in the end. In order to get it working, I had to call the method %Save() before the %Close() one: ... d file.CopyFrom(request.HttpResponse.Data) d file.%Save() w file.%Close() I found that by this article by @Gevorg Arutiunian: https://community.intersystems.com/post/save-file-using-nethttprequest