Question
· Aug 14

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 -->
    <hgroup id="filtersContainer">
      <group id="filter-group-documents">
        <text label="DocumentID:" id="filterDocumentID"/>
        <text label="DocumentSource:" id="filterDocumentSource"/>
      </group>
 
      <group id="filter-group-session-message">
        <text label="SessionID:" id="filterSessionID"/>
        <text label="MessageControlID:" id="filterMessageControlID"/>
      </group>
 
      <group id="filter-group-person-facility">
        <text label="PersonID:" id="filterPersonID"/>
        <text label="SourceFacility:" id="filterSourceFacility"/>
      </group>
 
      <group id="filter-group-event-encounter">
        <text label="EventType:" id="filterEventType"/>
        <text label="EncounterNumber:" id="filterEncounterNumber"/>
      </group>
 
      <group id="filter-group-message-date">
        <dateText label="Message Date From:" id="filterMessageDateFrom"/>
        <dateText label="Message Date To:" id="filterMessageDateTo"/>
      </group>
 
      <group id="filter-group-send-time">
        <dateText label="Send Time From:" id="filterSendTimeFrom"/>
        <dateText label="Send Time To:" id="filterSendTimeTo"/>
      </group>
 
    <!-- Active / Duplicate -->
    <group id="filter-group-checkboxes">
        <checkbox label="Is Active" id="filterIsActive"/>
        <checkbox label="Is Duplicate" id="filterIsDuplicate"/>
    </group>
 
    <!-- Last Update -->
    <group id="filter-group-last-update">
        <dateText label="Last Update From:" id="filterLastUpdateFrom"/>
        <dateText label="Last Update To:" id="filterLastUpdateTo"/>
    </group>
    <group id="filter-group-message-id">
        <text label="OriginalMessageID:" id="filterOriginalMessageID"/>
    </group>
    <group id="filter-group-search">
        <button caption="Search" onclick="zenPage.runSearch();"/>
    </group>
    </hgroup>
 
    <!-- Results Table -->
    <tablePane id="resultsTable"
               autoExecute="true"
               queryClass="MD.UI.MessageTrackingQuery"
               queryName="SearchMessages">
        <column colName="DocumentID" cellTitle="DocumentID" filterQuery="SearchMessages"/>
        <column colName="DocumentSource" cellTitle="DocumentSource" filterQuery="SearchMessages"/>
        <column colName="SessionID" cellTitle="SessionID" filterQuery="SearchMessages"/>
        <column colName="MessageControlID" cellTitle="MessageControlID" filterQuery="SearchMessages"/>
        <column colName="PersonID" cellTitle="PersonID" filterQuery="SearchMessages"/>
        <column colName="SourceFacility" cellTitle="SourceFacility" filterQuery="SearchMessages"/>
        <column colName="EventType" cellTitle="EventType" filterQuery="SearchMessages"/>
        <column colName="EncounterNumber" cellTitle="EncounterNumber" filterQuery="SearchMessages"/>
        <column colName="MessageDate" cellTitle="MessageDate" filterQuery="SearchMessages"/>
        <column colName="SendTime" cellTitle="SendTime" filterQuery="SearchMessages"/>
        <column colName="IsActive" cellTitle="IsActive" filterQuery="SearchMessages"/>
        <column colName="IsDuplicate" cellTitle="IsDuplicate" filterQuery="SearchMessages"/>
        <column colName="LastUpdateTime" cellTitle="LastUpdateTime" filterQuery="SearchMessages"/>
        <column colName="OriginalMessageID" cellTitle="OriginalMessageID" filterQuery="SearchMessages"/>
    </tablePane>
 
/// JS to run the search
ClientMethod runSearch() [ Language = javascript ]
{
    function normalize(value) {
        return (value === "" || value === undefined) ? null : value;
    }
 
    function normalizeDate(value, endOfDay) {
        if (!value) return null;
        // Otherwise append start or end of day
        return endOfDay ? value + " 23:59:59" : value + " 00:00:00";
    }
 
    var params = {
        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 (var key in params) {
        if (params[key] != null && params[key] !== "") {
            console.log(key + ": " + params[key]);
        }
    }
 
    // Assign to tablePane parameters and run query
    var table = zenPage.getComponentById('resultsTable');
    table.parameters = params;
    console.log(table.parameters);
    table.executeQuery(true, true);
    console.log(table.getColumnFilters());
}
Query SearchMessages(DocumentID, DocumentSource, SessionID, MessageControlID, PersonID, SourceFacility, EventType, EncounterNumber, MessageDateFrom, MessageDateTo, SendTimeFrom, SendTimeTo, IsActive, IsDuplicate, LastUpdateFrom, LastUpdateTo, OriginalMessageID) As %SQLQuery
{
    SELECT DocumentID, DocumentSource, SessionID, MessageControlID, PersonID, SourceFacility, EventType, EncounterNumber, MessageDate, SendTime,
           IsActive, IsDuplicate, LastUpdateTime, OriginalMessageID
    FROM MD.MessageTracking
    WHERE (DocumentID = :DocumentID OR :DocumentID IS NULL)
      AND (DocumentSource = :DocumentSource OR :DocumentSource IS NULL)
      AND (SessionID = :SessionID OR :SessionID IS NULL)
      AND (MessageControlID = :MessageControlID OR :MessageControlID IS NULL)
      AND (PersonID = :PersonID or :PersonID IS NULL)
      AND (SourceFacility = :SourceFacility or :SourceFacility IS NULL)
      AND (EventType = :EventType or :EventType IS NULL)
      AND (EncounterNumber = :EncounterNumber or :EncounterNumber IS NULL)
      AND (MessageDate >= :MessageDateFrom OR :MessageDateFrom IS NULL)
      AND (MessageDate <= :MessageDateTo OR :MessageDateTo IS NULL)
      AND (SendTime >= :SendTimeFrom OR :SendTimeFrom IS NULL)
      AND (SendTime <= :SendTimeTo OR :SendTimeTo IS NULL)
      AND (IsActive = :IsActive OR :IsActive IS NULL)
      AND (IsDuplicate = :IsDuplicate OR :IsDuplicate IS NULL)
      AND (LastUpdateTime >= :LastUpdateFrom OR :LastUpdateFrom IS NULL)
      AND (LastUpdateTime <= :LastUpdateTo OR :LastUpdateTo IS NULL)
      AND (OriginalMessageID = :OriginalMessageID OR :OriginalMessageID IS NULL)
}


 
Product version: IRIS 2022.3
Discussion (0)1
Log in or sign up to continue