system.tag.storeTagHistory Quality

Hi,
system.tag.storeTagHistory desn't work with quality value different to 192.
Someone has same problem?
data:

{   "timestamps": [
      {
        "$": [
          "ts",
          192,
          1738604325278
        ],
        "$ts": 1727128832000
      },
      {
        "$": [
          "ts",
          192,
          1738604325278
        ],
        "$ts": 1727128892000
      },
      {
        "$": [
          "ts",
          192,
          1738604325278
        ],
        "$ts": 1727128952000
      },
      {
        "$": [
          "ts",
          192,
          1738604325278
        ],
        "$ts": 1727129012000
      },
      {
        "$": [
          "ts",
          192,
          1738604325278
        ],
        "$ts": 1727129072000
      }
    ],
    "paths": [
      "folder2/path2/present_value",
      "folder2/path2/present_value",
      "folder2/path2/present_value",
      "folder2/path2/present_value",
      "folder2/path2/present_value"
    ],
    "values": [
      36.5,
      36.6,
      36.5,
      36.5,
      36.4
    ],
    "qualities": [
      203,
      203,
      203,
      203,
      203
    ]
  },
}

I don't see what the chunk of JSON you posted has to do with the storeTagHistory function.
What's the script you're using, and if the JSON is your evidence of it not working, where did it come from?

sorry, I explain better
I use system.tag.storeTagHistory in this way:

mydict= myDict= { "timestamps": 
	[{"$": ["ts", 192, 1738604325278 ], "$ts": 1727128832000 }
	, { "$": [ "ts", 192, 1738604325278 ], "$ts": 1727128892000 }
	, { "$": [ "ts", 192, 1738604325278 ], "$ts": 1727128952000 }
	, { "$": [ "ts", 192, 1738604325278 ], "$ts": 1727129012000 }
	, { "$": [ "ts", 192, 1738604325278 ], "$ts": 1727129072000 } ]
, "paths": [ "folder2/path2/present_value"
	, "folder2/path2/present_value"
	, "folder2/path2/present_value"
	, "folder2/path2/present_value"
	, "folder2/path2/present_value" ]
, "values": [ 36.5, 36.6, 36.5, 36.5, 36.4 ]
, "qualities": [ 203, 203, 203, 203, 203 ] 
}

system.tag.storeTagHistory("My History Provider"
                                              , "My Tag Provider"
                                              , mydict['paths']
                                              , mydict['values']
                                              , mydict['qualities']
                                              , mydict['timestamps']
)

Data insert is correct in db table, but quality column remains 0. It change only if I set quality to 192, but I want use a different value of good quality:

Good_Provisional	200	Good data that should not be considered valid long-term.
Good_Initial	    201	Indicates that the value is an initial/seed value for a system that is starting up.
Good_Overload	    202	​Represents good data that is being sampled slower than requested due to a resource limitation.
Good_Backfill	    203	Used to indicate good quality values that have arrived out of order. Different systems can choose to process them accordingly

Those aren't valid timestamps, so the function might be ignoring your extra inputs besides the paths and values.

I rewrote your code; this should be equivalent to what you were intending to do; does this give you the expected quality on output?

values = [36.5, 36.6, 36.5, 36.5, 36.4]
timestamps = [1727128832000, 1727128892000, 1727128952000, 1727129012000, 1727129072000]

dates = [system.date.fromMillis(ts) for ts in timestamps]
paths = ["folder2/path2/present_value"] * len(values)
qualities = [203] * len(values)

system.tag.storeTagHistory(
	"My History Provider", 
	"My Tag Provider", 
	paths,
	values, 
	qualities, 
	dates
)

Hi Paul,
you didn't understand the problem. My code works, stores data in DB. The problem is in quality code management. After running the script and the data is written to the DB, but if you see the data in the table you find that the quality column is 0 while from the script it should be 203.
In other words the quality parameter does not work.
If I specify a quality code, I should find it in the table.

The format of the timestamp in the json depends on the fact that I copied the field from a custom property of Perspective

Another problem is that the function returns nothing if the storage fails.