I need to store Int64 inside of PI Point, but as a pointtype one can choose only Int32. Is there a way around this?
I'd be curious to hear more about your application that requires Int64. The closest fit for you may be to use a point type of Float64 and cast accordingly.
thank you for the answer. The application comes from process automation for rolling mills and an identifier needed for material that should be rolled.
Please be aware that an int64 converted to float64 then back to int64 may lose a bit of precision. In general, if the top 11 bits of the integer are 0, you are OK, but if not, then there is the possibility that it will come back as a different value (off by 1).
What if I use Blob as pointtype for my purpose? I haven't used Blob type so far, does it make any sense at all?
A blob will round trip, but is harder to work with (you cannot see value in most OSIsoft clients). It requires you to assemble and disassembly your int64, and is relatively expensive in terms of performance. Many operations are not available (AFElement.FindElementsByAttributeValue for example).
I would suggest storing as either a string or two 32 bit integers over a blob.
Is there a reasonable maximum value that your application will have, or just a Int64.MaxValue? Is the identifier incremented sequentially or randomly chosen in a range? Following up on an earlier reply by Chris, if a 53-bit integer would suffice, that is to say a Int64 where the top 11 bits are 0, then a point type of float64 may be sufficient. If that's not the case, then I personally would choose to store this big identifier in one string PIPoint rather than two Int32 PIPoints.
The problem with my application is that I do not know the upper limit. What I know is that Int32 is not sufficient and that int64 covers all cases we've experienced so far.
In any case, thank you all for pointing out possible solutions and discussing their advantages/weaknesses.
I don't understand as to why you would not use a 10 digit or 15 digit string
As a matter of fact, after the previous discussion, I will try the solution with string as pointtype.
On the second thought, is it planned for future that PI Server supports 64-bit integers?
We have had other users request Int64 in the past and it is currently on the feature enhancements list. However, we have not committed to if or when it will be implemented.
Retrieving data ...