I've created a point of type blob using SMT3's point builder; it currently has a value of "Pt Created". How can I assign a value to this using SMT3's Archive Editor?
It seems to want only Analog or Digital from the selection box.
What kind value do you want to modify into the blob tag?, I did the test and effectively only permit put analog and digital values.
I'm trying to work out what values the blob will accept. Please give me an example of the value you managed to enter.
Blob are a typically chosen to store arrays of bytes. Its maximum size is 976 bytes.
I believe that PI SMT cannot convert the value you enter into bytes, you would need to do that using a programmatic approach.
A string tag has the same size limit as per this KB: https://techsupport.osisoft.com/Troubleshooting/KB/1482OSI8
So to write using PI SMT, I would definitely use a string tag.
Can you let us know what the application is for using a BLOB point type? Perhaps you can also comment on this post: What do you want to BLOB (not Blog) about??
Usually, we can substitute BLOB with other point types. Since BLOB is inherently arbitrary, a lot of times it will be easier to use/manipulate other point types.
If you would like to work with the tag programmatically, you can check out similar posts such as Getting snapshot and updating blob PI Point in C++.
As Patrice and Daphne have both mentioned, blob tags are used to store arbitrary arrays of bytes. Because of this, their real purpose is to act as a custom type that you can use in PI tags when other types do not suit your needs (float, int, digital, string, etc). As such, being a "custom" type, the expectation is that the user defines how to read/write to/from blob tags, as the user is the only one who would understand what this byte array represents.
I would recommend (as the others have) to try and find another existing type that would be suitable for your needs. If a blob tag is absolutely necessary, then we'd probably have to discuss more the actual use case and determine if there would be a good way to access the tag programmatically.
ok. So the REAL reason I asked the question was because I managed to get an application crash that affected my PI server; this is under investigation (OSIsoft TechSupport Case # 606272).
I created a tag ("t_blob")using SMT3's Point Builder of type Blob. I then used SMT3's Archive Editor to add a value. I tried a numeric and that was rejected; I then tried a string ("hello") and that, too, was rejected. I then tried the drop-down selector for the value which only offers analog or digital, and those values (a numeric of 1) , also, were rejected. I understood a blob to be of type byte array, and guessed I could try a comma-delimited string ("1,2,3,4"); this crashed SMT3, and also disconnected all of my networked connections (I was using PI-SMT in excel on another machine at the time).
So in summary, I haven't found a way of updating or adding a value to this tag, and was wondering if anyone else had; it seems that no-one has either!
From the Tech Support case, it appears that SMT crashed due to an InvalidCastException, which is likely due to some failure converting your string to a byte array. I was not able to reproduce the crash by entering "1,2,3,4" for a blob tag. Perhaps there were some other steps taken for SMT to crash?
However, SMT crashing should not be causing any kind of network disconnections for other programs. What kind of symptoms did you see in the PI-SMT Excel plug-in on the other machine?
To write to the blob tag, I found that you can actually use PI System Explorer to do this. You would need to create an attribute of type "Byte Array", then link this to the blob tag using a PI Point Data Reference. You can then specify the value (in decimal, 0-255) of each byte of the array. Keep in mind that there still aren't any good ways to "read" the values, since none of our programs will know what this byte array represents. If you look at the value in SMT, it will just say "<blob>". This again leads us to the original question... what are these blob tags being used for?
Thanks for your response. I was creating some test tags (1 of each type) with a value of 1 (or "1" as appropriate) to check that I could successfully read snapshot values for all (current) known tag types; I got stuck with the blob tag. This was the first step in developing an app, so I don't actually have a proper purpose for such a tag, other than "can I read a snapshot value from such a tag?". I guess that, without having a properly defined purpose (from a customer?) for such a tag, when I code my solution I'll just have to return something like "currently unsupported", and the problem goes away...
I should also have answered your other questions; my apologies.
I'm not aware of any other steps I took that caused the App crash. As to the symptoms in PI-SMT Excel plugin, I received a timeout and network disconnection (not sure of the actual wording now); reconnections were initially rejected (too soon to reconnect, please try later) before I could reconnect (a matter of a minute or so).
To complete the discussion, I've now used Excel and VBA to both write and read a tag of type Blob.
To read I needed to use a variant datatype and then assign the "value" entity to another variant which I processed as a byte array, concatenating each value into a delimited string. Tedious, but it works.
To write I assigned the delimited string elements to a redim'd byte array of the correct size and passed this to the PI value element, along with annotation and timestamp. This also works. Code snippets could be available if anyone is interested.
Thank you for the update! Since you offered, would you mind posting your code snippets in case some community members is interested in it now or in the future? Thanks.
Ok. Here’s a sample procedure to read and write to a tag of type blob using Excel 2007 VBA
Dim cxn As New PISDKDlg.Connections
Dim aServer As Server
'establish PI connection
cxn.ShowConnectionDialog False, vbModal
If cxn.Login.Connected Then
Set aServer = Servers(cxn.Login.name)
MsgBox "no PI connection"
'check it's valid
If aServer Is Nothing Then
MsgBox "invalid PI connection"
On Error Resume Next
Dim aTag As String
aTag = "t_blob" ' name of tag of type blob
Dim pipt As PISDK.PIPoint
Set pipt = aServer.PIPoints(aTag)
On Error GoTo 0
If pipt Is Nothing Then
MsgBox "tag not found, or not connected"
Dim tStamp As String
If pipt.PointType = pttypBlob Then
Dim vpv As Variant
' get the snapshot value
Set vpv = pipt.Data.Snapshot
If vpv Is Nothing Then
MsgBox "Error reading tag value"
'convert the variant to a string for representation purposes
z = vpv.Value ' this is a byte array
Dim s As String
Dim j As Integer
s = ""
j = 0
If j >= 976 Then Exit Do
If z(j) = 0 Then Exit Do
If s <> "" Then s = s & ";"
s = s & CStr(z(j))
j = j + 1
tStamp = Format(vpv.timestamp.LocalDate, "dd-mmm-yyyy hh:mm:ss")
MsgBox "tag=\\" & aServer.name & "\" & pipt.name & vbCrLf & "array()=" & s & vbCrLf & "timestamp=" & tStamp
Dim pv As PISDK.PIValue
' get the snapshot value
Set pv = pipt.Data.Snapshot
If pv Is Nothing Then
tStamp = Format(pv.timestamp.LocalDate, "dd-mmm-yyyy hh:mm:ss")
MsgBox "tag=\\" & " & aServer.name & "\" & pipt.name & vbCrLf & "value=" & pv.Value & vbCrLf & "timestamp=" & tStamp
Dim piVal As PIValue
Set piVal = New PISDK.PIValue
Dim bpv() As Byte
Dim sa() As String
Dim dlimiter As String
dlimiter = ";"
dim tx as string
tx = "1;2;3;4'
sa = Split(tx, dlimiter, , vbTextCompare)
j = Application.CountA(sa)
ReDim Preserve bpv(0 To j)
For Each qs In sa
If CInt(qs) > 255 Then
MsgBox "values cannot exceeed 255"
bpv(j) = CInt(qs)
piVal.Value = bpv
piVal.Value = .Range("values").Offset(r, 0).Value
'set the timestamp
Dim ts As New PITimeFormat
ts.FormatString = "dd-mmm-yyyy hh:mm:ss"
ts.InputString = "*"
Set piVal.timestamp = ts
' inserting values in PI
pipt.Data.UpdateValue piVal, DataMergeConstants.dmReplaceDuplicates
Retrieving data ...