I suggest a 3 step aproach :
- install PI OLEDB (not PI OLEDB Enterprise)
- open the example in \PIPC\OLEDB\Samples\ADO\ADO Intro\PI-ProcessBook
- try the following query:
SELECT TOP 5 tag, time, value, status FROM piarchive..picomp2
WHERE tag = 'sinusoid' AND time > '*-7d' ORDER BY value ASC
The query will return the TOP 5 values from the archive, and the order will be ASCending by value.
The query is executed via VBA, so you will have to open the VBA editor and locate the adoRs.Open line.
Hope this helps
If you didn't want to go the OLEDB route, you could use PISDK in the VBA of your display and output your results to a table (FlexGrid?) on the display. The PISDK to FlexGrid route could be as simple as retrieving the recorded values from a PIPoint over a 7 day period and extract the 5 lowest tag values.
It is a shame that when you use the recordset property of a PIValues collection that you cannot sort on the "Value" field.
Just curious...are there concerns about the 5 lowest values coming from distinct sags in the waveform? This too can be kind of tricky. It seems you might want to augment the approach with some server side processing (ACE / PE / SQC / TOTALIZER).