Question
· 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.

Discussion (10)1
Log in or sign up to continue

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.

Try this:

XData Contents [ XMLNamespace "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen">
  <tableNavigatorBar tablePaneId="tp1"/>
    <tablePane
      id="tp1"
      OnCreateResultSet="CreateRS"
      OnExecuteResultSet="ExecuteRS"
      maxRows="0"
      pageSize="10"
      useSnapshot="true"
    >
    <parameter value="USER1"/>
  </tablePane>
  <tableNavigatorBar tablePaneId="tp2"/>
    <tablePane
      id="tp2"
      OnCreateResultSet="CreateRS"
      OnExecuteResultSet="ExecuteRS"
      maxRows="0"
      pageSize="10"
      useSnapshot="true"
    >
    <parameter value="USER2"/>
  </tablePane>
</page>
}

For example so:

Class dc.test Extends %ZEN.Component.page
{

XData Style
{
<style type="text/css">
</style>
}

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

Method ExecuteRS(
  myRS As %ResultSet,
  Output pSC As %Status,
  pInfo As %ZEN.Auxiliary.QueryInfoAs %Boolean
{
  myRS.Prepare("select * from xyz")
  myRS.Execute()
  tSC=$$$OK
  q $$$YES
}

Method CreateRS(
  Output tSC As %Status,
  pInfo As %ZEN.Auxiliary.QueryInfoAs %ResultSet
{
  rs=##class(%RemoteResultSet).%New()
  rs.UserName="_system"
  rs.Password="SYS"
  rs.ConnectionString=$$$FormatText("localhost[%1]:%2",##class(%SQL.Manager.API).GetPort(),pInfo.parms(1))
  tSC=$$$OK
  q rs
}

}