go to post Vitaliy Serdtsev · Oct 19, 2018 Try ClientMethod changeParams() [ Language = javascript ] { var query = zen('categorieBeneficiaire'); var param1 = zen('catBParam1'); var param2 = zen('catBParam2'); param1.value='OS'; param2.value='NSAL'; query.refreshContents(); } /// This client event, if present, is fired when the page is loaded. ClientMethod onloadHandler() [ Language = javascript ] { zenPage.changeParams(); }
go to post Vitaliy Serdtsev · Oct 9, 2018 You don't need anything else to work with globals directly: Using the Globals API. See the code examples in <install-dir>\dev\dotnet\samples\globals
go to post Vitaliy Serdtsev · Oct 9, 2018 Another variants: USER>k s args=3,args(1)="-h",args(2)=21,args(3)="community.intersystems.com" do $system.OBJ.DisplayError(##class(%Net.Remote.Utility).RunCommandViaCPIPE("tracert",,.output,,900,.args)) w output or USER>k s args=3,args(1)="-h",args(2)=21,args(3)="community.intersystems.com" do $system.OBJ.DisplayError(##class(%Net.Remote.Utility).RunCommandViaZF("tracert",,.output,,900,,.args)) w output
go to post Vitaliy Serdtsev · Oct 9, 2018 See Handling of static dataEN or Обработка статикиRU. In your case, is enough will be the standard class %CSP.StreamServer (see streamserve.csp from CSP Samples). And you can use it to download external files, for example: %25CSP.StreamServer.cls?FILE=blablabla PS: by the way, it is not safe to transmit OID in open form, so pay attention to the method %CSP.Page:Encrypt(oid).
go to post Vitaliy Serdtsev · Oct 2, 2018 Changed a bit and added new code: /// d ##class(Scratch.test).ClassVsInst() ClassMethod ClassVsInst(N = {1e6}) [ ProcedureBlock = 0, PublicList = st ] { n p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, xClass, xInst, st s p1="пропоывшыщзшвыщшв" ,p2="гшщыгвыовлдыовдьыовдлоыдлв" ,p3="widuiowudoiwudoiwudoiwud" ,p4="прпроыпворыпворыпворыпв" ,p5="uywyiusywisywzxbabzjhagjЭ" ,p6="пропоывшыщзшвыщшв" ,p7="гшщыгвыовлдыовдьыовдлоыдлв" ,p8="widuiowudoiwudoiwudoiwud" ,p9="прпроыпворыпворыпворыпв" ,p10="uywyiusywisywzxbabzjhagjЭ" ,xClass="(args...) f i=1:1:N s sc=##class(Scratch.test).%1(args...)" ,xInst="(args...) f i=1:1:N s sc=st.%1(args...)" s st=##class(Scratch.test).%New() w $p($zv,"(Build"),!! d runClassmethod("dummyClass10", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ,runMethod("dummyClass10", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ,runMethod("dummyInst10", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ,runClassmethod("dummyClass5", p1, p2, p3, p4, p5) ,runMethod("dummyClass5", p1, p2, p3, p4, p5) ,runMethod("dummyInst5", p1, p2, p3, p4, p5) ,runClassmethod("dummyClassNull") ,runMethod("dummyClassNull") ,runMethod("dummyInstNull") ,runX("dummyClass10",xClass, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ,runX("dummyInst10",xInst, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ,runX("dummyClass5",xClass, p1, p2, p3, p4, p5) ,runX("dummyInst5",xInst, p1, p2, p3, p4, p5) ,runX("dummyClassNull",xClass) ,runX("dummyInstNull",xInst) runMethod(methodname,args...) n t,i,sc s t=$zh f i=1:1:N s sc=$method(st, methodname, args...) s t=$zh-t w methodname,?16,"total time = "_t,?38,"avg time = "_(t/N),! q runClassmethod(methodname,args...) n t,i,sc s t=$zh f i=1:1:N s sc=$classmethod("Scratch.test", methodname, args...) s t=$zh-t w methodname_"*",?16,"total time = "_t,?38,"avg time = "_(t/N),! q runX(methodname,x,args...) n t,i,sc s t=$zh x ($$$FormatText(x,methodname), args...) s t=$zh-t w "X"_methodname,?16,"total time = "_t,?38,"avg time = "_(t/N),! q }Result: USER>d ##class(Scratch.test).ClassVsInst() Cache for Windows (x86-64) 2018.1 dummyClass10* total time = .328227 avg time = .000000328227 dummyClass10 total time = .27655 avg time = .00000027655 dummyInst10 total time = .259913 avg time = .000000259913 dummyClass5* total time = .286983 avg time = .000000286983 dummyClass5 total time = .25666 avg time = .00000025666 dummyInst5 total time = .240312 avg time = .000000240312 dummyClassNull* total time = .274406 avg time = .000000274406 dummyClassNull total time = .250926 avg time = .000000250926 dummyInstNull total time = .234486 avg time = .000000234486 XdummyClass10 total time = .312917 avg time = .000000312917 XdummyInst10 total time = .264871 avg time = .000000264871 XdummyClass5 total time = .286985 avg time = .000000286985 XdummyInst5 total time = .238557 avg time = .000000238557 XdummyClassNull total time = .278684 avg time = .000000278684 XdummyInstNull total time = .236815 avg time = .000000236815
go to post Vitaliy Serdtsev · Sep 17, 2018 Still can be so: select relation_name tablename, %Library.SQLCatalog_SQLClassname(relation_name) classname from %Library.SQLCatalog_SQLTables() -- where relation_name [ 'aaa'
go to post Vitaliy Serdtsev · Sep 14, 2018 I have a few comments.: your code finds by the class name, not the table name, which is confusing For example, for the next class, the method finds nothing: Class dc.test Extends %Persistent [ SqlTableName = aaa ] { ... } USER>d ##class(objectscript.findTable).test("aaa") ? according to the documentation, your code uses the deprecated API: proof The Caché Library set of class definitions classes has been superseded by the %Dictionary package. The %Library classes described here are maintained for compatibility with existing applications. New code should make use of the classes within the %Dictionary package. in fact, the search is done elementary: select ClassName from %Dictionary.ClassDefinition_ClassIndex() where ClassName [ 'test' or select ClassName from %Dictionary.ClassDefinition_ClassIndex() where nvl(SqlTableName,ClassName) [ 'aaa'
go to post Vitaliy Serdtsev · Sep 14, 2018 Task Schedule (see Delete) %SYS.Task.History:PurgeHistory()
go to post Vitaliy Serdtsev · Sep 14, 2018 See %Document.Object; %SQL.Statement; %SQL.Util.Procedures (SQLProc = %SQL_Util.CSV / %SQL_Util.CSV_TO_CLASS).
go to post Vitaliy Serdtsev · Jul 26, 2018 Declaring Stream Properties You can store in the database not the files themselves, but only links to them. Thus, the size of your database will be small. Managing Caché You can create a custom task on a schedule in which you need programmatic to clean up old files and then compress cache.dat (compact/truncate).
go to post Vitaliy Serdtsev · Jul 26, 2018 $system.OBJ.Export() E.g. s all("blabla.MAC")="" s all("blabla.INT")="" s all("blabla.INC")="" s all("blabla.OBJ")="" s all("blabla.CLS")="" ; ... d $system.OBJ.Export(.all,"C:\temp\all.xml")
go to post Vitaliy Serdtsev · Jul 26, 2018 SELECT %ID,prop3 FROM mp.test WHERE %ID IN ( SELECT * FROM ( SELECT TOP ALL %ID FROM mp.test WHERE prop1='name' AND prop3>='1' AND prop3<='30' AND prop2='prop2' ORDER BY prop3 DESC ) WHERE %VID BETWEEN 1 AND 5 ) -- ORDER BY prop3 DESC
go to post Vitaliy Serdtsev · Jul 26, 2018 Working with Streams E.g. ;s stream=##class(%GlobalBinaryStream).%New() ;d stream.Write("--------") s file=##class(%Stream.FileBinary).%New() s file.Filename="C:\temp\test.txt" d file.CopyFromAndSave(stream)
go to post Vitaliy Serdtsev · Jul 26, 2018 And if so? s query = "select %ID,prop3 from mp.test where %ID in (SELECT * FROM (SELECT %ID FROM mp.test WHERE prop1='name' AND prop3>='1' AND prop3<='30' AND prop2='prop2') WHERE %VID BETWEEN 1 AND 5)"
go to post Vitaliy Serdtsev · Jul 25, 2018 Could you provide a complete example similar to mine (code + data + queries with sorting and filtering) that you have a issue with? How much all rows in the table? How much RAM? Which version $zv?
go to post Vitaliy Serdtsev · Jul 20, 2018 There are one error in the Test5 method: t4case* -> t5case*
go to post Vitaliy Serdtsev · Jul 20, 2018 Can also speed up, abandoning the indirect: s:'$d(addr3) addr3(1)=1, (addr3(2),addr3(8),addr3(9))=289, addr3(3)=3 d $case(addr3(value),1:t3case1,289:t3case289,3:t3case3,:t3case) ##; w !,r q t3case1 s r="Case 1" q t3case289 s r="Case 2,8-9" q t3case3 s r="Case 3" q t3case s r= "Case default" qBut the quickest option is if/elseif/else, since here is used inline-call, and not external-call.