today I want to share an error i have with a script to use the system data. This script works properly till 2024, I´m looking for the error, but I suposse that is about the system date format so maybe any one have the same problem, could you help me with this error?
I tried with capital letters "YYYY", but nothing happens.
A Jython key error is usually because you are trying to access something in the dict where there's no corresponding key.
This is your problem line.
dictEstimado has no key for '01'. You may want to print the entire
dictEstimado before your loop so you can inspect or better yet open script console in designer run
dictEstimado = getDictEstimated(plantId, startTime, endTime) with whatever parameters you are actually using and then you can really inspect it.
But is working for more than a year, I can use data of 2023 but I tried with the data from January 2024 and only get the error, it´s quite strange for me
It looks like
getDictEstimated runs a query (line 213). That's probably why. You had records or a configuration for 2023, but now it rolled over and you don't have a config row or a data or something and so the query doesn't return what you expect and so your dictionary is not what you expect.
You probably want to see what is going on in your
kpis_pr_estimado table for your plantid and tstamp.