Jump to content

How can I beat this error? Samples must be ordered by their keys!

Ivan Berry
Go to solution Solved by John Cox,

Recommended Posts


(400) Bad Request - Samples must be ordered by their keys! Sample (2023-04-22T22:19:40.083999600Z, 2.1432340145111084ppm) is followed by (2023-04-22T22:19:40.083999488Z, 2.1432340145111084ppm)

When adding properties to capsules I sometimes get this error, it is fairly random across many different PI tags in different servers. I believe it may be related to seeq version R61.1.6 as I have only just started seeing it. It is consistent for the tag and time period that the error occurs for.

This is the offending seeq formula. The signals in question trend just fine in Seeq.

$condition.setProperty('CO (minimum)', $co, minValue())
                        .setProperty('CO (maximum)', $co, maxValue())
                        .setProperty('O2 (minimum)', $o2, minValue())
                        .setProperty('O2 (maximum)', $o2, maxValue())      

I am sure there is something that needs to be fixed here in Seeq or PI to resolve this correctly, but I am looking for a crafty workaround I can use in the short term while our IT support figures this out.

Any ideas much appreciated!

Link to comment
Share on other sites

  • Seeq Team

Hi Ivan,

I would suggest clearing the cache on all the raw signals and conditions that are inputs to your Formula, as well as clearing cache on the Formula itself. You can clear the cache on an item using Item Properties in the Details Pane ("Clear Cached Values" under the Advanced section).

If this does not resolve the issue, I would suggest making an Office Hours appointment, so that a Seeq analytics engineer can assist you further: https://info.seeq.com/office-hours

Link to comment
Share on other sites

  • Seeq Team
  • Solution

Hi Ivan,

It's also possible that this is related to a software bug in version 61. This bug is fixed in future versions (starting in R64), but in the event you are falling victim to that same bug, here is a quick workaround you can try. It may or may not help, but is something you can try quickly. Basically you need to apply a .round(12) to each numeric signal used in the Formula, prior to the .setProperty functionality:

$rounded_co = $co.round(12)
$rounded_o2 = $o2.round(12)
$condition.setProperty('CO (minimum)', $rounded_co, minValue())
                        .setProperty('CO (maximum)', $rounded_co, maxValue())
                        .setProperty('O2 (minimum)', $rounded_o2, minValue())
                        .setProperty('O2 (maximum)', $rounded_o2, maxValue()) 
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • Seeq Team

Thanks for checking Ivan.  I'm not sure what is happening here.  I've not been able to reproduce this issue on our server.  I also checked our ticketing system and am unable to find known issues related to the calculation you are trying to perform (the previous bug you encountered was related to min/max formulas and is fixed in 62.0.7.)

I suspect there might be an issue upstream of the calculation - are you performing any min/max or other operations on $s?.  It might be more expedient to sign up for an office hour session so we can work this 1:1.


  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...