Vitaliy Serdtsev · Jul 18, 2018 go to post

Then try methods <FONT COLOR="#0000ff">$system</FONT><FONT COLOR="#008080">.Util</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Compress</FONT><FONT COLOR="#000000">/</FONT><FONT COLOR="#0000ff">Decompress</FONT>

Vitaliy Serdtsev · Jul 19, 2018 go to post

So, in order.

- The third article mentions a few options of which some are not available in Cache, such as LIMIT and OFFSET.
Caché has analogues - TOP N and %vid, which with more than replace the LIMIT/OFFSET. In the second link this is discussed in detail.
- And the 4th talks about using LIMIT and OFFSET which are, again, not available in Cache.
The essence of the article is to replace query
SELECT user_id, external_id, name, metadata, date_created
FROM users
ORDER BY user_id ASCLIMIT 50 000 000, 10 000; --- 5 000th page * 10 000 page size

10 000 rows in set (40.81 sec)

to
SELECT user_id, external_id, name, metadata, date_created
FROM users
WHERE user_id > 51 234 123 --- value of user_id for 50 000 000th recordORDER BY user_id ASCLIMIT 10 000

10 000 rows in set (0.03 sec)

Eventhough I am only asking for the first 100, there is still a major performance hit when executing the first rset.%Next() due to, what I assume is, the code trying to find the 100 records I am requesting out of the 1 mil records.
In this case, the following query is sufficient:
<FONT COLOR="#0000ff">SELECT </FONT><FONT COLOR="#000080">TOP </FONT><FONT COLOR="#000000">100 </FONT><FONT COLOR="#008000">prop </FONT><FONT COLOR="#000080">FROM </FONT><FONT COLOR="#008000">table </FONT><FONT COLOR="#000080">WHERE </FONT><FONT COLOR="#008000">prop</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">?</FONT>
-The second suggestion is what I am doing above. Using %VID with a subquery is just too slow when dealing with large datasets.

Is there an index for "prop"?

You tuned the table?

I have all works quickly:
<FONT COLOR="#000080">Class dc.test Extends %Persistent
</FONT><FONT COLOR="#000000">{

</FONT><FONT COLOR="#000080">Index </FONT><FONT COLOR="#000000">iprop On prop;

</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">prop </FONT><FONT COLOR="#000080">As %String</FONT><FONT COLOR="#000000">;

</FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">Fill(   </FONT><FONT COLOR="#ff00ff">Nrow </FONT><FONT COLOR="#000000">= {1e6},   </FONT><FONT COLOR="#ff00ff">Npage </FONT><FONT COLOR="#000000">= {1e3}) {   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#ff0000">DISABLE</FONT><FONT COLOR="#000000">^%NOJRN     ,..</FONT><FONT COLOR="#0000ff">%KillExtent</FONT><FONT COLOR="#000000">()      </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">time</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh     </FONT><FONT COLOR="#000000">,^dc.testD=</FONT><FONT COLOR="#800000">Nrow      </FONT><FONT COLOR="#0000ff">f </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=1:1:</FONT><FONT COLOR="#800000">Nrow </FONT><FONT COLOR="#800080">{     </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">p</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">-1</FONT><FONT COLOR="#800000">Npage</FONT><FONT COLOR="#000000">+1       ,</FONT><FONT COLOR="#800000">v</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">-1#</FONT><FONT COLOR="#800000">Npage</FONT><FONT COLOR="#000000">+1       ,</FONT><FONT COLOR="#800000">val</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">p</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#008000">":"</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">v       </FONT><FONT COLOR="#000000">,^dc.testD(</FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">)=</FONT><FONT COLOR="#0000ff">$lb</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">val</FONT><FONT COLOR="#000000">)       ,^dc.testI(</FONT><FONT COLOR="#008000">"iprop"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$$$SQLUPPER</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">val</FONT><FONT COLOR="#000000">),</FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">)=</FONT><FONT COLOR="#008000">""   </FONT><FONT COLOR="#800080">}      </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"(Fill) time = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$zh</FONT><FONT COLOR="#000000">-</FONT><FONT COLOR="#800000">time</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">" s."</FONT><FONT COLOR="#000000">,!!      </FONT><FONT COLOR="#0000ff">zw</FONT><FONT COLOR="#000000">:</FONT><FONT COLOR="#800000">Nrow</FONT><FONT COLOR="#000000"><=50 ^dc.testD,^dc.testI      </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#ff0000">ENABLE</FONT><FONT COLOR="#000000">^%NOJRN     ,</FONT><FONT COLOR="#0000ff">$system</FONT><FONT COLOR="#008080">.SQL</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">TuneTable</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$classname</FONT><FONT COLOR="#000000">(),</FONT><FONT COLOR="#0000ff">$$$YES</FONT><FONT COLOR="#000000">)     ,</FONT><FONT COLOR="#0000ff">$system</FONT><FONT COLOR="#008080">.OBJ</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Compile</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$classname</FONT><FONT COLOR="#000000">(),</FONT><FONT COLOR="#008000">"cu-d"</FONT><FONT COLOR="#000000">) }

</FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">Query(   </FONT><FONT COLOR="#ff00ff">q </FONT><FONT COLOR="#000080">As %TinyInt </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">,   </FONT><FONT COLOR="#ff00ff">prop </FONT><FONT COLOR="#000080">As %String</FONT><FONT COLOR="#000000">,   </FONT><FONT COLOR="#ff00ff">rownum1 </FONT><FONT COLOR="#000080">As %Integer</FONT><FONT COLOR="#000000">,   </FONT><FONT COLOR="#ff00ff">rownum2 </FONT><FONT COLOR="#000080">As %Integer</FONT><FONT COLOR="#000000">) {   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">(1)=</FONT><FONT COLOR="#008000">"select ,%vid from (select %ID,prop from dc.test where prop %startswith ?) where %vid between ? and ?"     </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">(2)=</FONT><FONT COLOR="#008000">"select ,%vid from (select %ID,prop from %ignoreindex iprop dc.test where prop like ?) where %vid between ? and ?"     </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">(3)=</FONT><FONT COLOR="#008000">"select *,%vid from (select top ? %ID,prop from %ignoreindex iprop dc.test where prop like ? order by %ID desc) order by %vid desc"

    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">time</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh     </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$s</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">q</FONT><FONT COLOR="#000000">=3:</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%SQL.Statement</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%ExecDirect</FONT><FONT COLOR="#000000">(,</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">q</FONT><FONT COLOR="#000000">),</FONT><FONT COLOR="#800000">rownum1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">prop</FONT><FONT COLOR="#000000">),              1:</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%SQL.Statement</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%ExecDirect</FONT><FONT COLOR="#000000">(,</FONT><FONT COLOR="#800000">sql</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">q</FONT><FONT COLOR="#000000">),</FONT><FONT COLOR="#800000">prop</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rownum1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rownum2</FONT><FONT COLOR="#000000">))        </FONT><FONT COLOR="#0000ff">i </FONT><FONT COLOR="#000000">'</FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%SQLCODE </FONT><FONT COLOR="#800080">{     </FONT><FONT COLOR="#0000ff">while </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%Next</FONT><FONT COLOR="#000000">() </FONT><FONT COLOR="#800080">{       </FONT><FONT COLOR="#008000">/*       s id=rs.%Get("ID")         ,prop=rs.%Get("prop")       w id," ",prop,!       */       </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%Print</FONT><FONT COLOR="#000000">()     </FONT><FONT COLOR="#800080">}   }   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"("</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$lts</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$lb</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">q</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">prop</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rownum1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rownum2</FONT><FONT COLOR="#000000">)),</FONT><FONT COLOR="#008000">") time = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$zh</FONT><FONT COLOR="#000000">-</FONT><FONT COLOR="#800000">time</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">" s."</FONT><FONT COLOR="#000000">,!! }

</FONT><FONT COLOR="#000080">/// d ##class(dc.test).Test() ClassMethod </FONT><FONT COLOR="#000000">Test() {   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000000">..</FONT><FONT COLOR="#0000ff">Fill</FONT><FONT COLOR="#000000">()     ,..</FONT><FONT COLOR="#0000ff">Query</FONT><FONT COLOR="#000000">(1,</FONT><FONT COLOR="#008000">"1000:"</FONT><FONT COLOR="#000000">,111,111+16)     ,..</FONT><FONT COLOR="#0000ff">Query</FONT><FONT COLOR="#000000">(2,</FONT><FONT COLOR="#008000">"%12%"</FONT><FONT COLOR="#000000">,111,111+16)     ,..</FONT><FONT COLOR="#0000ff">Query</FONT><FONT COLOR="#000000">(1,</FONT><FONT COLOR="#008000">"1"</FONT><FONT COLOR="#000000">,111984,111984+16)

    ,..</FONT><FONT COLOR="#0000ff">Query</FONT><FONT COLOR="#000000">(2,</FONT><FONT COLOR="#008000">"%12%"</FONT><FONT COLOR="#000000">,39584,39584+16) </FONT><FONT COLOR="#008000">;# slow (last 17)     </FONT><FONT COLOR="#000000">,..</FONT><FONT COLOR="#0000ff">Query</FONT><FONT COLOR="#000000">(3,</FONT><FONT COLOR="#008000">"%12%"</FONT><FONT COLOR="#000000">,17,</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">)          </FONT><FONT COLOR="#008000">;# fast (last 17) </FONT><FONT COLOR="#000000">} }</FONT>

Result:
USER><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">dc.test</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">Test</FONT><FONT COLOR="#000000">()</FONT>
(Fill) time = 1.277645 s.

999111 1000:111 111 999112 1000:112 112 999113 1000:113 113 999114 1000:114 114 999115 1000:115 115 999116 1000:116 116 999117 1000:117 117 999118 1000:118 118 999119 1000:119 119 999120 1000:120 120 999121 1000:121 121 999122 1000:122 122 999123 1000:123 123 999124 1000:124 124 999125 1000:125 125 999126 1000:126 126 999127 1000:127 127 (1,1000:,111,127) time = .084489 s.

5128 6:128 111 5129 6:129 112 5212 6:212 113 5312 6:312 114 5412 6:412 115 5512 6:512 116 5612 6:612 117 5712 6:712 118 5812 6:812 119 5912 6:912 120 6012 7:12 121 6112 7:112 122 6120 7:120 123 6121 7:121 124 6122 7:122 125 6123 7:123 126 6124 7:124 127 (2,%12%,111,127) time = .091251 s.

999984 1000:984 111984 999985 1000:985 111985 999986 1000:986 111986 999987 1000:987 111987 999988 1000:988 111988 999989 1000:989 111989 999990 1000:990 111990 999991 1000:991 111991 999992 1000:992 111992 999993 1000:993 111993 999994 1000:994 111994 999995 1000:995 111995 999996 1000:996 111996 999997 1000:997 111997 999998 1000:998 111998 999999 1000:999 111999 1000000 1000:1000 112000 (1,1,111984,112000) time = .66504 s.

999121 1000:121 39584 999122 1000:122 39585 999123 1000:123 39586 999124 1000:124 39587 999125 1000:125 39588 999126 1000:126 39589 999127 1000:127 39590 999128 1000:128 39591 999129 1000:129 39592 999212 1000:212 39593 999312 1000:312 39594 999412 1000:412 39595 999512 1000:512 39596 999612 1000:612 39597 999712 1000:712 39598 999812 1000:812 39599 999912 1000:912 39600 (2,%12%,39584,39600) time = 1.946264 s.

999121 1000:121 17 999122 1000:122 16 999123 1000:123 15 999124 1000:124 14 999125 1000:125 13 999126 1000:126 12 999127 1000:127 11 999128 1000:128 10 999129 1000:129 9 999212 1000:212 8 999312 1000:312 7 999412 1000:412 6 999512 1000:512 5 999612 1000:612 4 999712 1000:712 3 999812 1000:812 2 999912 1000:912 1 (3,%12%,17,) time = .089032 s.

Vitaliy Serdtsev · Jul 19, 2018 go to post

So, in order.

  1. There is no limit to perfection.

    Better then  d:(v=2)!(v=8)!(v=9) t3case289 q
  2. There are one error in the Test2 method:
      s:'$d(addraddr(1)=1, (addr(2),addr(8),addr(9))=289, add(3)=3
  3. There are error in the Test3 method:
      d:v=1 t3case1 Q ;will work in any way  d:v=2 t3case289 Q  d:v=8 t3case289 Q  d:v=9 t3case289 Q 
      d:v=3 t3case3 Q 
      d t3case 
  4. Speed will depend on many factors: RAM size, number of conditions (the more of them, the slower the lasts of them will be executed and more RAM is required).
Vitaliy Serdtsev · Jul 20, 2018 go to post

Can also speed up, abandoning the indirect:

  <FONT COLOR="#0000ff">s</FONT><FONT COLOR="#000000">:'</FONT><FONT COLOR="#0000ff">$d</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">(1)=1, (</FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">(2),</FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">(8),</FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">(9))=289, </FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">(3)=3
  
  </FONT><FONT COLOR="#0000ff">d $case</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">addr3</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">value</FONT><FONT COLOR="#000000">),1:</FONT><FONT COLOR="#ff0000">t3case1</FONT><FONT COLOR="#000000">,289:</FONT><FONT COLOR="#ff0000">t3case289</FONT><FONT COLOR="#000000">,3:</FONT><FONT COLOR="#ff0000">t3case3</FONT><FONT COLOR="#000000">,:</FONT><FONT COLOR="#ff0000">t3case</FONT><FONT COLOR="#000000">)
  </FONT><FONT COLOR="#008000">##; w !,r
  </FONT><FONT COLOR="#0000ff">q  

</FONT><FONT COLOR="#ff0000">t3case1   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">r</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Case 1"   </FONT><FONT COLOR="#0000ff">q </FONT><FONT COLOR="#ff0000">t3case289   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">r</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Case 2,8-9" </FONT><FONT COLOR="#0000ff">q </FONT><FONT COLOR="#ff0000">t3case3   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">r</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Case 3"   </FONT><FONT COLOR="#0000ff">q </FONT><FONT COLOR="#ff0000">t3case   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">r</FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">"Case default"   </FONT><FONT COLOR="#0000ff">q</FONT>

But the quickest option is if/elseif/else, since here is used inline-call, and not external-call.

Vitaliy Serdtsev · Jul 25, 2018 go to post

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?

Vitaliy Serdtsev · Jul 26, 2018 go to post

And if so?

<FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">query </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">"<FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">%ID</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">prop3 </FONT><FONT COLOR="#000080">from </FONT><FONT COLOR="#008000">mp</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">test </FONT><FONT COLOR="#000080">where </FONT><FONT COLOR="#008000">%ID </FONT><FONT COLOR="#000000">in (</FONT><FONT COLOR="#0000ff">SELECT </FONT><FONT COLOR="#000080">* FROM </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">SELECT </FONT><FONT COLOR="#008000">%ID </FONT><FONT COLOR="#000080">FROM </FONT><FONT COLOR="#008000">mp</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">test </FONT><FONT COLOR="#000080">WHERE </FONT><FONT COLOR="#008000">prop1</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008080">'name' </FONT><FONT COLOR="#000000">AND </FONT><FONT COLOR="#008000">prop3</FONT><FONT COLOR="#000000">>=</FONT><FONT COLOR="#008080">'1' </FONT><FONT COLOR="#000000">AND </FONT><FONT COLOR="#008000">prop3</FONT><FONT COLOR="#000000"><=</FONT><FONT COLOR="#008080">'30' </FONT><FONT COLOR="#000000">AND </FONT><FONT COLOR="#008000">prop2</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008080">'prop2'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">WHERE </FONT><FONT COLOR="#008000">%VID </FONT><FONT COLOR="#000000">BETWEEN 1 AND 5)</FONT>"</FONT>
Vitaliy Serdtsev · Jul 26, 2018 go to post
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
Vitaliy Serdtsev · Sep 14, 2018 go to post

I have a few comments.:

  1. your code finds by the class name, not the table name, which is confusing

    For example, for the next class, the method finds nothing:

    <FONT COLOR="#000080">Class dc.test Extends %Persistent </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">SqlTableName </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">aaa </FONT><FONT COLOR="#000000">] { ... }</FONT>

    USER>##class(objectscript.findTable).test("aaa")
    ?
  2. 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.

  3. in fact, the search is done elementary:

    <FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">ClassName </FONT><FONT COLOR="#000080">from </FONT><FONT COLOR="#008000">%Dictionary</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">ClassDefinition_ClassIndex</FONT><FONT COLOR="#000000">() </FONT><FONT COLOR="#000080">where </FONT><FONT COLOR="#008000">ClassName </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#008080">'test'</FONT>

    or

    <FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">ClassName </FONT><FONT COLOR="#000080">from </FONT><FONT COLOR="#008000">%Dictionary</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">ClassDefinition_ClassIndex</FONT><FONT COLOR="#000000">() </FONT><FONT COLOR="#000080">where </FONT><FONT COLOR="#808000">nvl</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">SqlTableName</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">ClassName</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#008080">'aaa'</FONT>

Vitaliy Serdtsev · Sep 17, 2018 go to post

Still can be so:

<FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">relation_name tablename</FONT><FONT COLOR="#000000">,
       </FONT><FONT COLOR="#008000">%Library</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">SQLCatalog_SQLClassname</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">relation_name</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">classname

</FONT><FONT COLOR="#000080">from </FONT><FONT COLOR="#008000">%Library</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">SQLCatalog_SQLTables</FONT><FONT COLOR="#000000">()

-- where relation_name [ 'aaa'</FONT>

Vitaliy Serdtsev · Oct 2, 2018 go to post

Changed a bit and added new code:

<FONT COLOR="#000080">/// d ##class(Scratch.test).ClassVsInst()
ClassMethod </FONT><FONT COLOR="#000000">ClassVsInst(</FONT><FONT COLOR="#ff00ff">N </FONT><FONT COLOR="#000000">= {1e6}) [ </FONT><FONT COLOR="#000080">ProcedureBlock </FONT><FONT COLOR="#000000">= 0, </FONT><FONT COLOR="#000080">PublicList </FONT><FONT COLOR="#000000">= st ]
{
   </FONT><FONT COLOR="#0000ff">n </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">xClass</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">xInst</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">st
   
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"пропоывшыщзшвыщшв"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"гшщыгвыовлдыовдьыовдлоыдлв"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"widuiowudoiwudoiwudoiwud"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"прпроыпворыпворыпворыпв"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"uywyiusywisywzxbabzjhagjЭ"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"пропоывшыщзшвыщшв"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"гшщыгвыовлдыовдьыовдлоыдлв"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"widuiowudoiwudoiwudoiwud"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"прпроыпворыпворыпворыпв"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"uywyiusywisywzxbabzjhagjЭ"
    
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xClass</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"(args...) f i=1:1:N s sc=##class(Scratch.test).%1(args...)"
    </FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xInst</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"(args...) f i=1:1:N s sc=st.%1(args...)"
   
   
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">st</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">Scratch.test</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%New</FONT><FONT COLOR="#000000">()
   
   </FONT><FONT COLOR="#0000ff">w $p</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$zv</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"(Build"</FONT><FONT COLOR="#000000">),!!
   
   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#ff0000">runClassmethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClass10"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClass10"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyInst10"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runClassmethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClass5"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClass5"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyInst5"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runClassmethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClassNull"</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClassNull"</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyInstNull"</FONT><FONT COLOR="#000000">)
   
    ,</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClass10"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xClass</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyInst10"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xInst</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p6</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p7</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p8</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p9</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p10</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClass5"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xClass</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyInst5"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xInst</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p1</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p2</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p3</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p4</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">p5</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyClassNull"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xClass</FONT><FONT COLOR="#000000">)
    ,</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"dummyInstNull"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">xInst</FONT><FONT COLOR="#000000">)
  
</FONT><FONT COLOR="#ff0000">runMethod</FONT><FONT COLOR="#000000">(methodname,args...)
   </FONT><FONT COLOR="#0000ff">n </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sc
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh f </FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">=1:1:</FONT><FONT COLOR="#800000">N </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">sc</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$method</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">st</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">methodname</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">...)
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh</FONT><FONT COLOR="#000000">-</FONT><FONT COLOR="#800000">t </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">methodname</FONT><FONT COLOR="#000000">,?16,</FONT><FONT COLOR="#008000">"total time = "</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">,?38,</FONT><FONT COLOR="#008000">"avg time = "</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">/</FONT><FONT COLOR="#800000">N</FONT><FONT COLOR="#000000">),!
   </FONT><FONT COLOR="#0000ff">q
</FONT><FONT COLOR="#ff0000">runClassmethod</FONT><FONT COLOR="#000000">(methodname,args...)
   </FONT><FONT COLOR="#0000ff">n </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sc
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh f </FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">=1:1:</FONT><FONT COLOR="#800000">N </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">sc</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$classmethod</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"Scratch.test"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">methodname</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">...)
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh</FONT><FONT COLOR="#000000">-</FONT><FONT COLOR="#800000">t </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">methodname</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#008000">"*"</FONT><FONT COLOR="#000000">,?16,</FONT><FONT COLOR="#008000">"total time = "</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">,?38,</FONT><FONT COLOR="#008000">"avg time = "</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">/</FONT><FONT COLOR="#800000">N</FONT><FONT COLOR="#000000">),!
   </FONT><FONT COLOR="#0000ff">q
</FONT><FONT COLOR="#ff0000">runX</FONT><FONT COLOR="#000000">(methodname,x,args...)
   </FONT><FONT COLOR="#0000ff">n </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">sc
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh
   x </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$$$FormatText</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">x</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">methodname</FONT><FONT COLOR="#000000">), </FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">...)
   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zh</FONT><FONT COLOR="#000000">-</FONT><FONT COLOR="#800000">t </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"X"</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">methodname</FONT><FONT COLOR="#000000">,?16,</FONT><FONT COLOR="#008000">"total time = "</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">,?38,</FONT><FONT COLOR="#008000">"avg time = "</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">t</FONT><FONT COLOR="#000000">/</FONT><FONT COLOR="#800000">N</FONT><FONT COLOR="#000000">),!
   </FONT><FONT COLOR="#0000ff">q
</FONT><FONT COLOR="#000000">}</FONT>
Result:

USER>##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
Vitaliy Serdtsev · Oct 9, 2018 go to post

Another variants:

USER><FONT COLOR="#0000ff">k  s </FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">=3,</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">(1)=</FONT><FONT COLOR="#008000">"-h"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">(2)=21,</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">(3)=</FONT><FONT COLOR="#008000">"community.intersystems.com" </FONT><FONT COLOR="#0000ff">do $system</FONT><FONT COLOR="#008080">.OBJ</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">DisplayError</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%Net.Remote.Utility</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">RunCommandViaCPIPE</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"tracert"</FONT><FONT COLOR="#000000">,,.</FONT><FONT COLOR="#800000">output</FONT><FONT COLOR="#000000">,,900,.</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">)) </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">output</FONT>

or

USER><FONT COLOR="#0000ff">k  s </FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">=3,</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">(1)=</FONT><FONT COLOR="#008000">"-h"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">(2)=21,</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">(3)=</FONT><FONT COLOR="#008000">"community.intersystems.com" </FONT><FONT COLOR="#0000ff">do $system</FONT><FONT COLOR="#008080">.OBJ</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">DisplayError</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%Net.Remote.Utility</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">RunCommandViaZF</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"tracert"</FONT><FONT COLOR="#000000">,,.</FONT><FONT COLOR="#800000">output</FONT><FONT COLOR="#000000">,,900,,.</FONT><FONT COLOR="#800000">args</FONT><FONT COLOR="#000000">)) </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">output</FONT>

Vitaliy Serdtsev · Oct 17, 2018 go to post

or <FONT COLOR="#0000ff">w $zcvt</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">x</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"I"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"HTML"</FONT><FONT COLOR="#000000">)</FONT>

Vitaliy Serdtsev · Oct 29, 2018 go to post

The functions from %qarfunc are actively used in system classes, so I don't think ^%qarfunc will be removed in the near future, otherwise everything will stop working.

Vitaliy Serdtsev · Oct 29, 2018 go to post

Also LPADSQL
USER><FONT COLOR="#0000ff">d $system</FONT><FONT COLOR="#008080">.SQL</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Shell</FONT><FONT COLOR="#000000">()</FONT>
SQL Command Line Shell

The command prefix is currently set to: <>. Enter q to quit, ? for help. USER>><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">lpad</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">'1'</FONT><FONT COLOR="#000000">,4,</FONT><FONT COLOR="#008080">'0'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">n</FONT>

  1.  <FONT COLOR="#0000ff">select&nbsp;</FONT><FONT COLOR="#008000">lpad</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">'1'</FONT><FONT COLOR="#000000">,4,</FONT><FONT COLOR="#008080">'0'</FONT><FONT COLOR="#000000">)&nbsp;</FONT><FONT COLOR="#008000">n</FONT>
    

n 0001

1 Rows(s) Affected

Vitaliy Serdtsev · Oct 30, 2018 go to post

Once upon a time promised to make Server-Side JavaScript alongside with Caché ObjectScript and Caché Basic:

I found a JS Runtime Shell that uses Node.JS & esprima:

SAMPLES><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%CPT.JS.Runtime.Shell</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">Run</FONT><FONT COLOR="#000000">()</FONT>

JRS> ?

.L CLASS - load javascript methods from CLASS into JS global namespace .LV var,.. - load the given COS public vars into JS global namespace

.S FUNC - list the source of the method which implements function FUNC - FUNC must be in the global namespace - the whole implementing method is shown, even for an inner function - this will also work for non-javascript methods .M - list MAC code from latest compilation .I - list INT code from latest compilation .T - show latest tree

.G - list global symbols

.N CODE - execute JS on node.js .N - execute the last-entered line of JS on node.js

.CONFIG ... - passed to %CPT.CalloutShell 'CONFIG' command

.SET ... - passed to %CPT.CalloutShell 'SET' command .CLEAR ... - passed to %CPT.CalloutShell 'CLEAR' command .SHOW ... - passed to %CPT.CalloutShell 'SHOW' command

!COS - execute a line of COS

Anything else is interpreted as JS. :-

  • if preceded by "=" it must be a single function definition
  • otherwise it can be either a single expression or a sequence of statements separated by ";"s

Either way it will be compiled into a function body and :-

  • if preceded by "==" it is stored as a JS global with the new function's name
  • otherwise it will just be executed

\n can be used to represent a newline.

You can also take input from a file :- <FILE - read JS from FILE and compile+execute it <=FILE - read JS from FILE and compile+store it

The result of the execution is shown and also stored in global variable '_'.

For a global variable, set it without using 'var' (this will be fixed)

JRS> .N <FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">obj </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">{ name: </FONT><FONT COLOR="#800000">"John"</FONT><FONT COLOR="#000000">, age: </FONT><FONT COLOR="#000080">30</FONT><FONT COLOR="#000000">, city: </FONT><FONT COLOR="#800000">"New York" </FONT><FONT COLOR="#000000">}; JSON.stringify(obj);</FONT> {result: "{""name"":""John"",""age"":30,""city"":""New York""}"}

JRS> .N Math.random() {result: .5670654247514904}

JRS> .N <FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">fruits </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">[</FONT><FONT COLOR="#800000">"Banana"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">"Orange"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">"Apple"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">"Mango"</FONT><FONT COLOR="#000000">]; fruits.sort();</FONT> {result: ["Apple", "Banana", "Mango", "Orange", 1: "Apple", 2: "Banana", 3: "Mango", 4: "Orange"]}

JRS> q

SAMPLES>

Vitaliy Serdtsev · Nov 1, 2018 go to post

I was looking at the generated INT code for <FONT COLOR="#800080">&sql(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008000">lpad</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">'1'</FONT><FONT COLOR="#000000">,4,</FONT><FONT COLOR="#008080">'0'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">n</FONT><FONT COLOR="#800080">)</FONT>

Unfortunately, for COS at the moment I have not found an analogue LPADSQL. Can you offer a documented LPADCOS ?

Vitaliy Serdtsev · Nov 1, 2018 go to post

Maybe the name of the topic to specify a CSV-string instead of string ?

After clarification, the question became more clear.

Vitaliy Serdtsev · Nov 2, 2018 go to post

No. If you beware to use %occLibrary, you may look into side %Regex.Matcher

Here is another documented solution:

<FONT COLOR="#0000ff">#include </FONT><FONT COLOR="#000000">%systemInclude
  </FONT><FONT COLOR="#0000ff">n
  try</FONT><FONT COLOR="#800080">{

    </FONT><FONT COLOR="#0000ff">#define </FONT><FONT COLOR="#000000">TAB </FONT><FONT COLOR="#0000ff">$c(9)          s </FONT><FONT COLOR="#800000">csv</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"""ABC,"</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(10)</FONT><FONT COLOR="#008000">" Company,"",""123 Main St, Ste 102"",""Anytown, DC"",10001,234-567-8901,""Anytown"</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#0000ff">$$$TAB</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#008000">"DC"""

    </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%DeepSee.TermList</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%ParseCSVRecord</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">csv</FONT><FONT COLOR="#000000">,.</FONT><FONT COLOR="#800000">arr</FONT><FONT COLOR="#000000">)

    </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">csv</FONT><FONT COLOR="#000000">,!!,</FONT><FONT COLOR="#0000ff">$$</FONT><FONT COLOR="#ff0000">WriteCSVRecord</FONT><FONT COLOR="#000000">(.</FONT><FONT COLOR="#800000">arr</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$$$TAB</FONT><FONT COLOR="#000000">)

  </FONT><FONT COLOR="#800080">}</FONT><FONT COLOR="#0000ff">catch</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">ex</FONT><FONT COLOR="#000000">)</FONT><FONT COLOR="#800080">{     </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"Error "</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">ex</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">DisplayString</FONT><FONT COLOR="#000000">(),!   </FONT><FONT COLOR="#800080">}

</FONT><FONT COLOR="#ff0000">WriteCSVRecord</FONT><FONT COLOR="#000000">(&pRecord, pDelim=</FONT><FONT COLOR="#008000">","</FONT><FONT COLOR="#000000">, pEncode=</FONT><FONT COLOR="#0000ff">$$$YES</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">{   </FONT><FONT COLOR="#008000">// made on the basis of the method %WriteCSVRecord   </FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">r </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#008000">""   </FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">k </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#0000ff">$O</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pRecord</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">))   </FONT><FONT COLOR="#0000ff">While </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">k</FONT><FONT COLOR="#000000">'=</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">{     </FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">tValue </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#0000ff">$G</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pRecord</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">k</FONT><FONT COLOR="#000000">))     </FONT><FONT COLOR="#0000ff">Set</FONT><FONT COLOR="#000000">:</FONT><FONT COLOR="#0000ff">$G</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pEncode</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800000">tValue </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#0000ff">$ZCVT</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">tValue</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"O"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"UTF8"</FONT><FONT COLOR="#000000">) 

    </FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">r </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800000">r </FONT><FONT COLOR="#000000"> </FONT><FONT COLOR="#0000ff">$S</FONT><FONT COLOR="#000000">((</FONT><FONT COLOR="#800000">tValue</FONT><FONT COLOR="#000000">[</FONT><FONT COLOR="#008000">""""</FONT><FONT COLOR="#000000">)||(</FONT><FONT COLOR="#800000">tValue</FONT><FONT COLOR="#000000">[</FONT><FONT COLOR="#008000">","</FONT><FONT COLOR="#000000">)||(</FONT><FONT COLOR="#800000">tValue</FONT><FONT COLOR="#000000">[</FONT><FONT COLOR="#800000">pDelim</FONT><FONT COLOR="#000000">):</FONT><FONT COLOR="#0000ff">$$$quote</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">tValue</FONT><FONT COLOR="#000000">),1:</FONT><FONT COLOR="#800000">tValue</FONT><FONT COLOR="#000000">)     </FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">k </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#0000ff">$O</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pRecord</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">k</FONT><FONT COLOR="#000000">))     </FONT><FONT COLOR="#0000ff">Set</FONT><FONT COLOR="#000000">:</FONT><FONT COLOR="#800000">k</FONT><FONT COLOR="#000000">'=</FONT><FONT COLOR="#008000">"" </FONT><FONT COLOR="#800000">r </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800000">r </FONT><FONT COLOR="#000000"> </FONT><FONT COLOR="#800000">pDelim   </FONT><FONT COLOR="#800080">}   </FONT><FONT COLOR="#0000ff">Quit </FONT><FONT COLOR="#800000">r </FONT><FONT COLOR="#800080">}</FONT>

Result:
USER><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000000">^dc</FONT>
"ABC,
Company,","123 Main St, Ste 102","Anytown, DC",10001,234-567-8901,"Anytown        DC"

"ABC, Company," "123 Main St, Ste 102" "Anytown, DC" 10001 234-567-8901 "Anytown DC"

Vitaliy Serdtsev · Jan 15, 2019 go to post

See zenConvertType() [///Converts a typed value returned from the server to an appropriate JS type] from zenutils.js.

Try this:

<script src="zenutils.js"></script>

<script language="javascript">
function isItActuallyFalse() {

var bool zenConvertType('BOOLEAN',#server(..giveMeAFalse())#);

...
}

</script>

<script language="cache" method="giveMeAFalse" arguments="" returntype="%Boolean" procedureblock='1'>return $$$NO</script>
or
var bool zenBool(#server(..giveMeAFalse())#);

... <<FONT COLOR="#ff0000">script </FONT><FONT COLOR="#000080">language</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800080">"cache" </FONT><FONT COLOR="#000080">method</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800080">"giveMeAFalse" </FONT><FONT COLOR="#000080">arguments</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800080">"" </FONT><FONT COLOR="#000080">returntype</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800080">"%Boolean" </FONT><FONT COLOR="#000080">procedureblock</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800080">'1'</FONT><FONT COLOR="#000000">></FONT><FONT COLOR="#0000ff">return </FONT><FONT COLOR="#008000">"false"</FONT><FONT COLOR="#000000"></</FONT><FONT COLOR="#ff0000">script</FONT><FONT COLOR="#000000">></FONT>

Vitaliy Serdtsev · Jan 16, 2019 go to post
if I call giveMeAFalseMe from Cache when it's returning "true" or "false", Cache will translate "true" into a truthy %Boolean return value, right?

No, it does zenBool, which is on the client side.

The important thing is that #server()# always returns a string, for example:

<script language="cache" method="giveMeAFalse" arguments="" procedureblock='1' returntype="%Integer">return 4</script>var bool #server(..giveMeAFalse())#;
console.log("bool = " bool);
console.log("typeof bool = "typeof bool);

Result:
bool = 4
typeof bool =  string
PS: you can further explore the sources of the #server()# -> cspHttpServerMethod() -> cspProcessResponse(), which are in the file cspxmlhttp.js.
Vitaliy Serdtsev · Feb 16, 2019 go to post

The presence of a potential opportunity to read the documentation via "Class Reference". For macros from *.inc this is not possible.

Vitaliy Serdtsev · Feb 18, 2019 go to post

Hi Adrian.

Made a small example:

<FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">rs </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%ResultSet
   
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">pid</FONT><FONT COLOR="#000000">=4652
   
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%ResultSet</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%New</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"%SYS.ProcessQuery:VariableByPid"</FONT><FONT COLOR="#000000">)
   
</FONT><FONT COLOR="#0000ff">f </FONT><FONT COLOR="#800000">filter</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"a*" </FONT><FONT COLOR="#800080">{
 </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#000000">!,</FONT><FONT COLOR="#008000">"Filter = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$$$quote</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">filter</FONT><FONT COLOR="#000000">),!
 </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Execute</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">pid</FONT><FONT COLOR="#000000">,,,,</FONT><FONT COLOR="#800000">filter</FONT><FONT COLOR="#000000">)
 </FONT><FONT COLOR="#0000ff">while </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Next</FONT><FONT COLOR="#000000">() </FONT><FONT COLOR="#800080">{
   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"Name = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Get</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"Name"</FONT><FONT COLOR="#000000">),</FONT><FONT COLOR="#008000">", Value = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Get</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"Value"</FONT><FONT COLOR="#000000">),!
 </FONT><FONT COLOR="#800080">}
}</FONT>
Result:
USER:4652><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">a</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"11"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">b</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"22"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">a1</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"33" </FONT><FONT COLOR="#0000ff">w $job</FONT>
4652

USER:1392><FONT COLOR="#0000ff">w $job</FONT><FONT COLOR="#000000">,! </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000000">^dc</FONT> 1392

Filter = "" Name = a, Value = 11 Name = a1, Value = 33 Name = b, Value = 22

Filter = "a*" Name = a, Value = 11 Name = a1, Value = 33

Vitaliy Serdtsev · Feb 22, 2019 go to post

What will the following code output?

USER><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#800000">arr </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">pObject</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%CopyToArray</FONT><FONT COLOR="#000000">(.</FONT><FONT COLOR="#800000">arr</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#0000ff">zw </FONT><FONT COLOR="#800000">arr</FONT>

PS: "in" ≠ "expires_in"

Vitaliy Serdtsev · Feb 22, 2019 go to post

What will the following code output?

<FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">resptext</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"{""access_token"":""4SDFDSFDSF-aSDASDASD"",""expires_in"":""3300"",""refresh_token"":"""",""scope"":""sms_send"",""token_type"":""Bearer""}"

</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">sc </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%ZEN.Auxiliary.jsonProvider</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%ParseJSON</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">resptext</FONT><FONT COLOR="#000000">,,.</FONT><FONT COLOR="#800000">pObject</FONT><FONT COLOR="#000000">,1) </FONT><FONT COLOR="#0000ff">i $$$ISOK</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">sc</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">{   </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">pObject</FONT><FONT COLOR="#000000">,!!,     </FONT><FONT COLOR="#800000">pObject</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">"access_token"</FONT><FONT COLOR="#000000">,!,     </FONT><FONT COLOR="#800000">pObject</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">"expires_in"</FONT><FONT COLOR="#000000">,!   </FONT><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#800000">arr </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">arr</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"" </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">pObject</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">%CopyToArray</FONT><FONT COLOR="#000000">(.</FONT><FONT COLOR="#800000">arr</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#0000ff">zw </FONT><FONT COLOR="#800000">arr </FONT><FONT COLOR="#800080">}</FONT><FONT COLOR="#0000ff">else</FONT><FONT COLOR="#800080">{   </FONT><FONT COLOR="#0000ff">d $system</FONT><FONT COLOR="#008080">.OBJ</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">DisplayError</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">sc</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">}</FONT>

My result (2018.1):
USER><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000000">^test</FONT>
1@%ZEN.proxyObject

4SDFDSFDSF-aSDASDASD 3300 arr("access_token")="4SDFDSFDSF-aSDASDASD" arr("expires_in")=3300 arr("refresh_token")="" arr("scope")="sms_send" arr("token_type")="Bearer"