Zen report table no content message

81 views
Skip to first unread message

Jon Goody

unread,
Feb 11, 2012, 12:17:51 PM2/11/12
to InterSystems: Zen Community
Is there a way to display a message in replace of a table that has no
content in a ZEN Report.

E.g list of patient allergys but if none then message states 'no
allergies found for this patient'?

Cheers

Jon

Roberto

unread,
Feb 13, 2012, 10:02:14 AM2/13/12
to InterSystems: Zen Community
You can do something like this:

In ReportDefinition:

<group name="top" sql="SELECT TOP 100 ClientID FROM db.Client WHERE
ClientID %STARTSWITH 'X'">
<group name="record">
<element name="ClientID" field="ClientID"/>
</group>
</group>

In ReportDisplay:

<body>
<table group="top/record" ifexpression="%report.IsZeroRecords()>0">
<item field="ClientID"/>
</table>
<inline ifexpression="%report.IsZeroRecords()=0">NO RECORDS</inline>
</body>

In the ClassMethod:

ClassMethod IsZeroRecords() As %Integer [ ZenMethod ]
{
Set returnValue=0
&sql(
SELECT COUNT(ClientID) INTO :returnValue
FROM db.Client
WHERE ClientID %STARTSWITH 'X'
)

Quit returnValue
}

-Roberto

APZ

unread,
Feb 14, 2012, 9:54:25 AM2/14/12
to InterSystems: Zen Community
In Roberto's example, the report uses an "ifexpression" conditional so
that a class- or instance-method can control whether to output the
table or the message.

Similar effect can be achieved using an "ifxpath" conditional. This
technique removes the need for a new method and its SQL query because
it uses the provided XML data from ReportDefinition, but does rely on
some knowledge of XPath.

The formula to follow is: for the table, the "ifxpath" expression is
the same as the "group" expression. For the no-data message, the
"ifxpath" expression is the table's "group" expression but wrapped in
the XPath NOT() function. All of this is case-sensitive, and the
function must be in lower-case.

Using the same Report Definition as before, the ReportDisplay would
contain:

<body>
<table group="top/record" ifxpath="top/record">
<item field="ClientID"/>
</table>
<inline ifxpath="not(top/record)">NO RECORDS</inline>
</body>

Both "ifexpression" and "ifxpath" are effective techniques for
conditionally displaying a table (or anything else) in a ZEN Report.


Ariela Zonderman

Goody Jon (NHS LOTHIAN)

unread,
Feb 14, 2012, 2:18:35 PM2/14/12
to intersys...@googlegroups.com, InterSystems: Zen Community
Thanks Ariela

Much apprieciated and will give this a try.

Jon Goody

On 14 Feb 2012, at 14:54, "APZ" <azo...@intersystems.com> wrote:

> In Roberto's example, the report uses an "ifexpression" conditional so
> that a class- or instance-method can control whether to output the
> table or the message.
>
> Similar effect can be achieved using an "ifxpath" conditional. This
> technique removes the need for a new method and its SQL query because
> it uses the provided XML data from ReportDefinition, but does rely on
> some knowledge of XPath.
>
> The formula to follow is: for the table, the "ifxpath" expression is
> the same as the "group" expression. For the no-data message, the
> "ifxpath" expression is the table's "group" expression but wrapped in
> the XPath NOT() function. All of this is case-sensitive, and the
> function must be in lower-case.
>
> Using the same Report Definition as before, the ReportDisplay would
> contain:
>
> <body>
> <table group="top/record" ifxpath="top/record">

> <item field="ClientID"/>
> </table>

> <inline ifxpath="not(top/record)">NO RECORDS</inline>
> </body>
>
> Both "ifexpression" and "ifxpath" are effective techniques for
> conditionally displaying a table (or anything else) in a ZEN Report.
>
>
> Ariela Zonderman
>

> --
> You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
> To post to this group, send email to InterSys...@googlegroups.com
> To unsubscribe from this group, send email to InterSystems-Z...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/InterSystems-ZEN?hl=en
> Zen Community Terms and Conditions: http://groups.google.com/group/InterSystems-ZEN/web/community-terms-and-conditions

********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere
For more information and to find out how you can switch, visit www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************

Reply all
Reply to author
Forward
0 new messages