Scripting > CxVhs > VhsClient Iterator Objects > PointIterator Object > PointIterator Methods

PointIterator Methods

The PointIterator object contains the following methods:

Initialize

The Initialize method initializes a Point Iterator object.

Syntax

Initialize(VhsSiteService As String, OrderByPointIdLong As Long, Unused As Long) As Long

Parameters

Parameter Required Description

VhsSiteService

Yes

The site and service name of the VHS point tag, in "site.service" format.

OrderByPointIdLong

Yes

Set to any nonzero number to sort the points alphabetically by Long ID, or zero to leave them unsorted.

Unused

Yes

This can be any Long number, but it doesn’t affect anything.

Remarks

This function initializes the point iterator object to the start or end of the point list, depending on the value of Backward. The return value is based on whether the initialization was successful or not (1 = Success; 0 = Failure). When initialized, the iterator cursor moves to the first point by default.

Example

The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForward methods of the PointIterator Object. It displays a list of all points in a VHS.

Sub ShowAllPoints (vhsService)

Dim vhsPointIter, vhsHistoryIter, tag, stat

lstPoints.ResetContent

 

Set vhsPointIter = CreateObject("CxVhsLib.PointIterator")

Set tag = CreateObject("CxVhsLib.HistoryTagStringEx")

Set stat = CreateObject("CxVhsLib.HistoryStats")

 

'Initialize point iterator with Short Point ID, going forward

vhsPointIter.Initialize vhsService, 0, 0

vhsPointIter.MoveFirst

 

'Show all points in a list box

While (vhsPointIter.GetForward(tag, stat))

lstPoints.AddString(tag.TagString)

Wend

End Sub

Back to top

GetBackward

The GetBackward method retrieves information about the previous point in the iteration list.

Syntax

GetBackward(pTag As Variant, pStats As Variant) As Long

Parameters

Parameter Required Description

pTag

Yes

Output. Returns the site, service, Short Point ID, Long Point ID, and tag string for a point in the VHS.

Type: HistoryTagStringEx

pStats

Yes

Output. Returns the entry count, timestamp start, timestamp end, and expiration days for a point in the VHS.

Type: HistoryStats

Remarks

The GetBackward function retrieves information for a point and moves the cursor backward. The return value is 1 while there are still points in the list. When the end of the list is reached, 0 is returned.

Example

The following subroutine demonstrates the use of the Initialize, MoveLast, and GetBackward methods of the PointIterator Object. It displays a list of the last thirty points in a VHS.

Sub ShowLastThirty (vhsService)

Dim vhsPointIter, vhsHistoryIter, tag, stat, counter

lstPoints.ResetContent

counter = 0

 

Set vhsPointIter = CreateObject("CxVhsLib.PointIterator")

Set tag = CreateObject("CxVhsLib.HistoryTagStringEx")

Set stat = CreateObject("CxVhsLib.HistoryStats")

 

'Initialize point iterator with Long Point ID, going backward

vhsPointIter.Initialize vhsService, 1, 1

vhsPointIter.MoveLast

 

'Show all points in a list box

While ((vhsPointIter.GetBackward(tag, stat)) And (counter < 30))

lstPoints.AddString(tag.TagString)

counter = counter + 1;

Wend

End Sub

Back to top

GetForward

The GetForward method retrieves information about the next point in the iteration list.

Syntax

GetForward(pTag As Variant, pStats As Variant) As Long

Parameters

Parameter Required Description

pTag

Yes

Output. Returns the site, service, Short Point ID, Long Point ID, and tag string for a point in the VHS.

Type: HistoryTagStringEx

pStats

Yes

Output. Returns the entry count, timestamp start, timestamp end, and expiration days for a point in the VHS.

Type: HistoryStats

Remarks

The GetForward function retrieves information for the next point and moves the cursor forward. The return value is 1 while there are still points in the list. When the end of the list is reached, 0 is returned.

Example

The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForward methods of the PointIterator Object. It displays a list of all points in a VHS.

Sub ShowAllPoints (vhsService)

Dim vhsPointIter, vhsHistoryIter, tag, stat

lstPoints.ResetContent

 

Set vhsPointIter = CreateObject("CxVhsLib.PointIterator")

Set tag = CreateObject("CxVhsLib.HistoryTagStringEx")

Set stat = CreateObject("CxVhsLib.HistoryStats")

 

'Initialize point iterator with Short Point ID, going forward

vhsPointIter.Initialize vhsService, 0, 0

vhsPointIter.MoveFirst

 

'Show all points in a list box

While (vhsPointIter.GetForward(tag, stat))

lstPoints.AddString(tag.TagString)

Wend

End Sub

Back to top

MoveAfter

The MoveAfter method moves the cursor after the given point.

Syntax

MoveAfter(pTag As Variant) As Long

Parameters

Parameter Required Description

pTag

Yes

Sets the point to move the cursor after.

Type: HistoryTagStringEx

Remarks

The MoveAfter function moves the cursor forward without retrieving information.

Back to top

MoveBefore

The MoveBefore method moves the cursor before the given point.

Syntax

MoveBefore(pTag As Variant) As Long

Parameters

Parameter Required Description

pTag

Yes

Sets the point to move the cursor before.

Type: HistoryTagStringEx

Remarks

The MoveBefore function moves the cursor backwards without retrieving information.

Back to top

MoveFirst

The MoveFirst method moves to the first entry in the iteration list.

Syntax

MoveFirst() As Long

Remarks

Returns a value based on whether the method was successful or not (1 = Success; 0 = Failure).

Example

The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForward methods of the PointIterator Object. It displays a list of all points in a VHS.

Sub ShowAllPoints (vhsService)

Dim vhsPointIter, vhsHistoryIter, tag, stat

lstPoints.ResetContent

 

Set vhsPointIter = CreateObject("CxVhsLib.PointIterator")

Set tag = CreateObject("CxVhsLib.HistoryTagStringEx")

Set stat = CreateObject("CxVhsLib.HistoryStats")

 

'Initialize point iterator with Short Point ID, going forward

vhsPointIter.Initialize vhsService, 0, 0

vhsPointIter.MoveFirst

 

'Show all points in a list box

While (vhsPointIter.GetForward(tag, stat))

lstPoints.AddString(tag.TagString)

Wend

End Sub

Back to top

MoveLast

The MoveLast method moves to the last entry in the iteration list.

Syntax

MoveLast() As Long

Remarks

Returns a value based on whether the method was successful or not (1 = Success; 0 = Failure).

Example

The following subroutine demonstrates the use of the Initialize, MoveLast, and GetBackward methods of the PointIterator Object. It displays a list of the last thirty points in a VHS.

Sub ShowLastThirty (vhsService)

Dim vhsPointIter, vhsHistoryIter, tag, stat, counter

lstPoints.ResetContent

counter = 0

 

Set vhsPointIter = CreateObject("CxVhsLib.PointIterator")

Set tag = CreateObject("CxVhsLib.HistoryTagStringEx")

Set stat = CreateObject("CxVhsLib.HistoryStats")

 

'Initialize point iterator with Long Point ID, going backward

vhsPointIter.Initialize vhsService, 1, 1

vhsPointIter.MoveLast

 

'Show all points in a list box

While ((vhsPointIter.GetBackward(tag, stat)) And (counter < 30))

lstPoints.AddString(tag.TagString)

counter = counter + 1;

Wend

End Sub

Back to top

MoveTo

The MoveTo method moves the cursor to the given point.

Syntax

MoveTo(pTag As Variant) As Long

Parameters

Parameter Required Description

pTag

Yes

Sets the point to move the cursor to.

Type: HistoryTagStringEx

Remarks

The MoveTo function moves the cursor without retrieving information.

Example

The following example demonstrates the use of MoveTo, Initialize, and GetForward. It jumps to a specified point and displays all the points after it in a list box.

Sub VhsMoveTo()

Dim VhsPointIter, Tag, Stat

Set VhsPointIter = CreateObject("CxVhsLib.PointIterator")

Set Tag = CreateObject("CxVhsLib.HistoryTagStringEx")

Set Stat = CreateObject("CxVhsLib.HistoryStats")

 

Tag.TagString = "CYGDEMO.VHS.00000068"

 

VhsPointIter.Initialize "CYGDEMO.VHS", 1, 1

VhsPointIter.MoveTo(Tag)

 

'Show remaining points in a list box

While ((VhsPointIter.GetForward(tag, stat))

lstPoints.AddString(tag.TagString)

Wend

End Sub

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.