Question Jimmy Christian · May 14, 2019

Zen Page Table From another namespace

Hello,

Need some technique to solve an issue about zen page table.

- "xyz" table exists in all my namespaces.

I have a simple Zen page  in "USER 1" namespace. It has a tablepane which pulls data from "xyz" table.

OnLoad of the page i want the  zenpage to pull the data from "USER 2" namespace with same "xyz" table name.

Zenpage has to be in  "USER 1" namespace

I tried to use the server side callback handler %OnAfterCreatePage()  and do a ZNSPACE "USER 2" but still it is not doing the job of pulling data from another namespace.

Any suggestions will be appreciated.

Thanks,

Jimmy Christian.

Comments

Neerav Verma · May 14, 2019

Share globals and packages across Namespaces. Thats the only way

0
Jimmy Christian  May 14, 2019 to Neerav Verma

Thanks Neerav.

I still believe  we can do in the code by using a callback method. I am not sure how to use it.

0
Jimmy Christian  May 16, 2019 to Neerav Verma

I cannot share globals on the namepsace i am working on.

Actually i was able to retrieve data from Namespace2  working on a callback method for recordset which the table  is using. But now issue is zenpage only shows the first page.

Will try to find out a reason why the page is hanging. It could be that i have to flip back to Namespace1 once i get the recordset.

Thanks.

0
Jimmy Christian  May 17, 2019 to Vitaliy Serdtsev

Hello Vitaliy,

Thank you for your time. This works good. Issue is that i only see the first page of the results.

Even after adding the tableNavigatorBar, it still shows only one page  and not all the results. I have more than 30,000 rows to display on the page. Let me know.

Thanks,

Jimmy

0
Neerav Verma  May 14, 2019 to Jimmy Christian

Callbacks are for Stored Procedures which are a part of Database.

What I would suggest is make a minimal view in your namespace 2 and just share that with Namespace1 , if that works for you

0
Jimmy Christian  May 14, 2019 to Neerav Verma

Thanks Neerav.

I am referring to the zenpage call back methods, which are called on a zenpage event.

Problem is i cannot create any views in namespace2.

0
Jimmy Christian  May 17, 2019 to Vitaliy Serdtsev

Vitaliy, This is great !

The code works fine now. Appreciate your help and time.

I have to put some filters on the columns now, which i think i have to use the QueryInfo Object.

Thank you !

Regards,

Jimmy Christian.

0
Vitaliy Serdtsev  May 17, 2019 to Jimmy Christian

Try this:

<FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Contents [ </FONT><FONT COLOR="#000080">XMLNamespace </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#000000">]
{
<</FONT><FONT COLOR="#000080">page </FONT><FONT COLOR="#800000">xmlns</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"http://www.intersystems.com/zen"</FONT><FONT COLOR="#000000">>
  <</FONT><FONT COLOR="#000080">tableNavigatorBar </FONT><FONT COLOR="#800000">tablePaneId</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"tp1"</FONT><FONT COLOR="#000000">/>
    <</FONT><FONT COLOR="#000080">tablePane
      </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"tp1"
      </FONT><FONT COLOR="#800000">OnCreateResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"CreateRS"
      </FONT><FONT COLOR="#800000">OnExecuteResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"ExecuteRS"
      </FONT><FONT COLOR="#800000">maxRows</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"0"
      </FONT><FONT COLOR="#800000">pageSize</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"10"
      </FONT><FONT COLOR="#800000">useSnapshot</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"true"
    </FONT><FONT COLOR="#000000">>
    <</FONT><FONT COLOR="#000080">parameter </FONT><FONT COLOR="#800000">value</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"USER1"</FONT><FONT COLOR="#000000">/>
  </</FONT><FONT COLOR="#000080">tablePane</FONT><FONT COLOR="#000000">>
  <</FONT><FONT COLOR="#000080">tableNavigatorBar </FONT><FONT COLOR="#800000">tablePaneId</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"tp2"</FONT><FONT COLOR="#000000">/>
    <</FONT><FONT COLOR="#000080">tablePane
      </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"tp2"
      </FONT><FONT COLOR="#800000">OnCreateResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"CreateRS"
      </FONT><FONT COLOR="#800000">OnExecuteResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"ExecuteRS"
      </FONT><FONT COLOR="#800000">maxRows</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"0"
      </FONT><FONT COLOR="#800000">pageSize</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"10"
      </FONT><FONT COLOR="#800000">useSnapshot</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"true"
    </FONT><FONT COLOR="#000000">>
    <</FONT><FONT COLOR="#000080">parameter </FONT><FONT COLOR="#800000">value</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"USER2"</FONT><FONT COLOR="#000000">/>
  </</FONT><FONT COLOR="#000080">tablePane</FONT><FONT COLOR="#000000">>
</</FONT><FONT COLOR="#000080">page</FONT><FONT COLOR="#000000">>
}</FONT>
0
Neerav Verma  May 16, 2019 to Jimmy Christian

Zen stores data in snapshots for pagination. May be its not able to do so by a callback method.

0
Vitaliy Serdtsev · May 17, 2019

For example so:

<FONT COLOR="#000080">Class dc.test Extends %ZEN.Component.page
</FONT><FONT COLOR="#000000">{

</FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Style { <</FONT><FONT COLOR="#000080">style </FONT><FONT COLOR="#800000">type</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"text/css"</FONT><FONT COLOR="#000000">> </</FONT><FONT COLOR="#000080">style</FONT><FONT COLOR="#000000">> }

</FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Contents [ </FONT><FONT COLOR="#000080">XMLNamespace </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#000000">] { <</FONT><FONT COLOR="#000080">page </FONT><FONT COLOR="#800000">xmlns</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"http://www.intersystems.com/zen"</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">tablePane     </FONT><FONT COLOR="#800000">OnCreateResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"CreateRS"     </FONT><FONT COLOR="#800000">OnExecuteResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"ExecuteRS"   </FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">parameter </FONT><FONT COLOR="#800000">name</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"ns" </FONT><FONT COLOR="#800000">value</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"USER1"</FONT><FONT COLOR="#000000">/>   </</FONT><FONT COLOR="#000080">tablePane</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">tablePane     </FONT><FONT COLOR="#800000">OnCreateResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"CreateRS"     </FONT><FONT COLOR="#800000">OnExecuteResultSet</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"ExecuteRS"   </FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">parameter </FONT><FONT COLOR="#800000">name</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"ns" </FONT><FONT COLOR="#800000">value</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"USER2"</FONT><FONT COLOR="#000000">/>   </</FONT><FONT COLOR="#000080">tablePane</FONT><FONT COLOR="#000000">> </</FONT><FONT COLOR="#000080">page</FONT><FONT COLOR="#000000">> }

</FONT><FONT COLOR="#000080">Method </FONT><FONT COLOR="#000000">ExecuteRS(   </FONT><FONT COLOR="#ff00ff">myRS </FONT><FONT COLOR="#000080">As %ResultSet</FONT><FONT COLOR="#000000">,   </FONT><FONT COLOR="#000080">Output </FONT><FONT COLOR="#ff00ff">pSC </FONT><FONT COLOR="#000080">As %Status</FONT><FONT COLOR="#000000">,   </FONT><FONT COLOR="#ff00ff">pInfo </FONT><FONT COLOR="#000080">As %ZEN.Auxiliary.QueryInfo</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">As %Boolean </FONT><FONT COLOR="#000000">{   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">myRS</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Prepare</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"select * from xyz"</FONT><FONT COLOR="#000000">)   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">myRS</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Execute</FONT><FONT COLOR="#000000">()   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">tSC</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$$$OK   q $$$YES </FONT><FONT COLOR="#000000">}

</FONT><FONT COLOR="#000080">Method </FONT><FONT COLOR="#000000">CreateRS(   </FONT><FONT COLOR="#000080">Output </FONT><FONT COLOR="#ff00ff">tSC </FONT><FONT COLOR="#000080">As %Status</FONT><FONT COLOR="#000000">,   </FONT><FONT COLOR="#ff00ff">pInfo </FONT><FONT COLOR="#000080">As %ZEN.Auxiliary.QueryInfo</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">As %ResultSet </FONT><FONT COLOR="#000000">{   </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">%RemoteResultSet</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%New</FONT><FONT COLOR="#000000">()   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">UserName</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"_system"   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Password</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"SYS"   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">rs</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">ConnectionString</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$$$FormatText</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"localhost[%1]:%2"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%SQL.Manager.API</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">GetPort</FONT><FONT COLOR="#000000">(),</FONT><FONT COLOR="#800000">pInfo</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">parms</FONT><FONT COLOR="#000000">(1))   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">tSC</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$$$OK   q </FONT><FONT COLOR="#800000">rs </FONT><FONT COLOR="#000000">}

}</FONT>

0