ZenPage Table not Updating
Hi all,
I’m running into an issue with a %ZEN.Component.tablePane in a Zen page.
We have:
- A fully styled table with all columns defined
- A backend query (
SearchMessages) that accepts multiple filter parameters - A set of input fields at the top of the page for filtering (text, date, and checkboxes)
We’re trying to run the query from a button click using a client-side method (runSearch()) that collects the filter values, sets them as parameters, and calls executeQuery().
The problem is that the table does not update at all. Old rows remain, or sometimes nothing appears. I am struggling to debug this issue and anyone with experience making zen tables and updating them using queries would be extremely helpful. Below is a bit of my code
<!--Filters-->
<hgroupid="filtersContainer">
<groupid="filter-group-documents">
<textlabel="DocumentID:"id="filterDocumentID"/>
<textlabel="DocumentSource:"id="filterDocumentSource"/>
</group>
<groupid="filter-group-session-message">
<textlabel="SessionID:"id="filterSessionID"/>
<textlabel="MessageControlID:"id="filterMessageControlID"/>
</group>
<groupid="filter-group-person-facility">
<textlabel="PersonID:"id="filterPersonID"/>
<textlabel="SourceFacility:"id="filterSourceFacility"/>
</group>
<groupid="filter-group-event-encounter">
<textlabel="EventType:"id="filterEventType"/>
<textlabel="EncounterNumber:"id="filterEncounterNumber"/>
</group>
<groupid="filter-group-message-date">
<dateTextlabel="Message Date From:"id="filterMessageDateFrom"/>
<dateTextlabel="Message Date To:"id="filterMessageDateTo"/>
</group>
<groupid="filter-group-send-time">
<dateTextlabel="Send Time From:"id="filterSendTimeFrom"/>
<dateTextlabel="Send Time To:"id="filterSendTimeTo"/>
</group>
<!--Active/Duplicate-->
<groupid="filter-group-checkboxes">
<checkboxlabel="Is Active"id="filterIsActive"/>
<checkboxlabel="Is Duplicate"id="filterIsDuplicate"/>
</group>
<!--LastUpdate-->
<groupid="filter-group-last-update">
<dateTextlabel="Last Update From:"id="filterLastUpdateFrom"/>
<dateTextlabel="Last Update To:"id="filterLastUpdateTo"/>
</group>
<groupid="filter-group-message-id">
<textlabel="OriginalMessageID:"id="filterOriginalMessageID"/>
</group>
<groupid="filter-group-search">
<buttoncaption="Search"onclick="zenPage.runSearch();"/>
</group>
</hgroup>
<!--ResultsTable-->
<tablePaneid="resultsTable"
autoExecute="true"
queryClass="MD.UI.MessageTrackingQuery"
queryName="SearchMessages">
<columncolName="DocumentID"cellTitle="DocumentID"filterQuery="SearchMessages"/>
<columncolName="DocumentSource"cellTitle="DocumentSource"filterQuery="SearchMessages"/>
<columncolName="SessionID"cellTitle="SessionID"filterQuery="SearchMessages"/>
<columncolName="MessageControlID"cellTitle="MessageControlID"filterQuery="SearchMessages"/>
<columncolName="PersonID"cellTitle="PersonID"filterQuery="SearchMessages"/>
<columncolName="SourceFacility"cellTitle="SourceFacility"filterQuery="SearchMessages"/>
<columncolName="EventType"cellTitle="EventType"filterQuery="SearchMessages"/>
<columncolName="EncounterNumber"cellTitle="EncounterNumber"filterQuery="SearchMessages"/>
<columncolName="MessageDate"cellTitle="MessageDate"filterQuery="SearchMessages"/>
<columncolName="SendTime"cellTitle="SendTime"filterQuery="SearchMessages"/>
<columncolName="IsActive"cellTitle="IsActive"filterQuery="SearchMessages"/>
<columncolName="IsDuplicate"cellTitle="IsDuplicate"filterQuery="SearchMessages"/>
<columncolName="LastUpdateTime"cellTitle="LastUpdateTime"filterQuery="SearchMessages"/>
<columncolName="OriginalMessageID"cellTitle="OriginalMessageID"filterQuery="SearchMessages"/>
</tablePane>
///JS to run the search
ClientMethodrunSearch() [ Language = javascript ]
{
functionnormalize(value) {
return (value===""||value===undefined) ?null:value;
}
functionnormalizeDate(value, endOfDay) {
if (!value) returnnull;
// Otherwise append start or end of day
returnendOfDay?value+" 23:59:59":value+" 00:00:00";
}
varparams= {
DocumentID: normalize(zenPage.getComponentById('filterDocumentID').getValue()),
DocumentSource: normalize(zenPage.getComponentById('filterDocumentSource').getValue()),
SessionID: normalize(zenPage.getComponentById('filterSessionID').getValue()),
MessageControlID: normalize(zenPage.getComponentById('filterMessageControlID').getValue()),
PersonID: normalize(zenPage.getComponentById('filterPersonID').getValue()),
SourceFacility: normalize(zenPage.getComponentById('filterSourceFacility').getValue()),
EventType: normalize(zenPage.getComponentById('filterEventType').getValue()),
EncounterNumber: normalize(zenPage.getComponentById('filterEncounterNumber').getValue()),
MessageDateFrom: normalizeDate(zenPage.getComponentById('filterMessageDateFrom').getValue(), false),
MessageDateTo: normalizeDate(zenPage.getComponentById('filterMessageDateTo').getValue(), true),
SendTimeFrom: normalizeDate(zenPage.getComponentById('filterSendTimeFrom').getValue(), false),
SendTimeTo: normalizeDate(zenPage.getComponentById('filterSendTimeTo').getValue(), true),
IsActive: zenPage.getComponentById('filterIsActive').getValue() ?1:null,
IsDuplicate: zenPage.getComponentById('filterIsDuplicate').getValue() ?1:null,
LastUpdateFrom: normalizeDate(zenPage.getComponentById('filterLastUpdateFrom').getValue(), false),
LastUpdateTo: normalizeDate(zenPage.getComponentById('filterLastUpdateTo').getValue(), true),
OriginalMessageID:normalize(zenPage.getComponentById('filterOriginalMessageID').getValue())
};
console.log("Starting to get results");
console.log("Filters:");
console.log("------------------------");
for (varkeyinparams) {
if (params[key] !=null&¶ms[key] !=="") {
console.log(key+": "+params[key]);
}
}
// Assign to tablePane parameters and run query
vartable=zenPage.getComponentById('resultsTable');
table.parameters=params;
console.log(table.parameters);
table.executeQuery(true, true);
console.log(table.getColumnFilters());
}
QuerySearchMessages(DocumentID, DocumentSource, SessionID, MessageControlID, PersonID, SourceFacility, EventType, EncounterNumber, MessageDateFrom, MessageDateTo, SendTimeFrom, SendTimeTo, IsActive, IsDuplicate, LastUpdateFrom, LastUpdateTo, OriginalMessageID) As%SQLQuery
{
SELECTDocumentID, DocumentSource, SessionID, MessageControlID, PersonID, SourceFacility, EventType, EncounterNumber, MessageDate, SendTime,
IsActive, IsDuplicate, LastUpdateTime, OriginalMessageID
FROMMD.MessageTracking
WHERE (DocumentID = :DocumentIDOR:DocumentIDISNULL)
AND (DocumentSource = :DocumentSourceOR:DocumentSourceISNULL)
AND (SessionID = :SessionIDOR:SessionIDISNULL)
AND (MessageControlID = :MessageControlIDOR:MessageControlIDISNULL)
AND (PersonID = :PersonIDor:PersonIDISNULL)
AND (SourceFacility = :SourceFacilityor:SourceFacilityISNULL)
AND (EventType = :EventTypeor:EventTypeISNULL)
AND (EncounterNumber = :EncounterNumberor:EncounterNumberISNULL)
AND (MessageDate >= :MessageDateFromOR:MessageDateFromISNULL)
AND (MessageDate <= :MessageDateToOR:MessageDateToISNULL)
AND (SendTime >= :SendTimeFromOR:SendTimeFromISNULL)
AND (SendTime <= :SendTimeToOR:SendTimeToISNULL)
AND (IsActive = :IsActiveOR:IsActiveISNULL)
AND (IsDuplicate = :IsDuplicateOR:IsDuplicateISNULL)
AND (LastUpdateTime >= :LastUpdateFromOR:LastUpdateFromISNULL)
AND (LastUpdateTime <= :LastUpdateToOR:LastUpdateToISNULL)
AND (OriginalMessageID = :OriginalMessageIDOR:OriginalMessageIDISNULL)
}
Product version: IRIS 2022.3
Discussion (0)0