Counting the number of images captured or uploaded into an Image Annotation field is as simple as checking the Image Annotation field’s attachment length. Because of the audit-trail specialization of Mi-Forms, though, the count will not recognize if any images have been removed. To do this, a simple count for each attachment, that does not have the ‘RemovedUser’ property filled, is used.


In VB.Net, the image count can be obtained with the following script:

 <MiCode(ControlScriptEventType.AfterInkAdded, "Hotspot")> _

 Public Sub Ctl_Pen_AfterInkAdded(ByVal e As AfterInkAddedEventArgs)

 Dim count = 0

 For Each img As ImageData In _ImageAnnotation.ImageData

            If img.RemovedUser = "" Then


            End If



 End Sub

The MsgBox at the end will deliver an updated image attachment count no matter how many, or if any were removed. In this case, the count is triggered by ink added in a Hotspot.


It is currently not possible to obtain the image count after user removal of images in Javascript, however, you can have the server trap the count using the VB.Net code above in the “AfterDataPathsRun” event. Instead of using the MsgBox call, you will want to use LogMessage(count) call or the

Me.RecordExportResult("Image Count:", True, count, "", count)