Page 1 of 1

Query results updated

Published: April 8, 2026 - 9:08 AM
by j.repple
Good morning,

I am working with WAPT Enterprise version 2.5.5.15697.

I recently added the Audit Battery package to my repository. I then pushed the package to the laptops in my fleet.

In the audit data I do get the information about the battery installed in the unit.
So I prepared a query in the Reporting to monitor the health status of the batteries.

Here is the request:

Code: Select all

WITH cte AS (
    SELECT ctid,
           host_id,
           value_date,
           row_number() OVER (PARTITION BY host_id, value_key ORDER BY value_date) AS rank
    FROM HostAuditData
    WHERE value_section = 'audit-battery' AND value_key = 'audit-battery'
)
SELECT
    cte.value_date AS Date_Audit,
    h.computer_fqdn,
    h.last_logged_on_user,
    h.manufacturer,
    h.productname,
    had.value->'BATTERY_1'->'Health' as Santé_Batterie
FROM HostAuditData had
JOIN cte ON cte.ctid = had.ctid
JOIN hosts h ON h.uuid = cte.host_id
WHERE cte.rank = 1;
The result seems good, but I have the impression that it does not update over time.

Example: I have a workstation that shows me (in the query result) an audit date of 24-03-26 and a battery health of 16% while my audit data in the workstation inventory shows me a date of 31/03/26 and a battery health of 52% (I changed it in the meantime).

I am therefore wondering if there is a way to update the query result with the new audit data?
However, I still have the impression that the new machines that install the package do appear in the query results.

THANKS.

Re: Updating query results

Published: April 27, 2026 - 11:44 AM
by filou07
Good morning,
In line 5, you replace

Code: Select all

ORDER BY value_date
by

Code: Select all

ORDER BY value_date DESC
This will therefore assign the most recent line to rank 1.
Good day