Scripting > CxGrp > GrpBuilder Object > GrpBuilder Methods

GrpBuilder Methods

The GrpBuilder object contains the following methods:

Note: Some of the examples in this topic use the WScript.Sleep statement, which is not recommended for use when scripting in CygNet Studio. Use TheView EventTimer instead.

CancelBuild

The CancelBuild method cancels any currently-running hierarchy build.

Syntax

CancelBuild(iSecondsToWait As Integer) As Boolean

Parameters

Parameter Required Description

iSecondsToWait

Yes

The maximum number of seconds to wait for cancellation before returning.

Remarks

This method will hang for a maximum of iSecondsToWait before returning.  If the time interval specified by iSecondsToWait expires before the build cancels, this method will return false.

Example

The following example starts to build a hierarchy and immediately cancels the build.

Sub

GrpBuilder.StartBuildingHierarchy "CYGDEMO.GRP", "Navigation Hierarchy"

 

GrpBuilder.CancelBuild(5)

End Sub

Back to top

GetBuildResults

The GetBuildResults method returns the results of the last build.

Syntax

GetBuildResults() As String

Example

The following example builds a hierarchy and displays the results.

Sub

GrpBuilder.StartBuildingHierarchy "CYGDEMO.GRP", "Navigation Hierarchy"

 

While GrpBuilder.IsBuilding()

WScript.Sleep(100)

Wend

 

Dim strMsg

If GrpBuilder.WasBuildSuccessful() Then

strMsg = GrpBuilder.GetBuildResults()

Else

strMsg = "Build failed for the following reason(s):" + vbCr + vbCr

strMsg = strMsg + GrpBuilder.GetBuildResults()

End If

 

MsgBox strMsg

End Sub

Back to top

IsBuilding

The IsBuilding method returns true if there is a build currently in process.

Syntax

IsBuilding() As Boolean

Example

The following example builds a hierarchy and displays the results.

Sub

GrpBuilder.StartBuildingHierarchy "CYGDEMO.GRP", "Navigation Hierarchy"

 

While GrpBuilder.IsBuilding()

WScript.Sleep(100)

Wend

 

Dim strMsg

If GrpBuilder.WasBuildSuccessful() Then

strMsg = GrpBuilder.GetBuildResults()

Else

strMsg = "Build failed for the following reason(s):" + vbCr + vbCr

strMsg = strMsg + GrpBuilder.GetBuildResults()

End If

 

MsgBox strMsg

End Sub

Back to top

StartBuildingHierarchy

The StartBuildingHierarchy method starts building a specified hierarchy.

Syntax

StartBuildingHierarchy(grpService As String, hierarchy As String) As Boolean

Parameters

Parameter Required Description

grpService

Yes

The GRP Site.Service to which to connect.

hierarchy

Yes

The description of a Navigation Root Node.  This Node must be of type Navigation Root (~V) and in the Root Group (R) category.

Example

The following example builds a hierarchy and displays the results.

Sub

GrpBuilder.StartBuildingHierarchy "CYGDEMO.GRP", "Navigation Hierarchy"

 

While GrpBuilder.IsBuilding()

WScript.Sleep(100)

Wend

 

Dim strMsg

If GrpBuilder.WasBuildSuccessful() Then

strMsg = GrpBuilder.GetBuildResults()

Else

strMsg = "Build failed for the following reason(s):" + vbCr + vbCr

strMsg = strMsg + GrpBuilder.GetBuildResults()

End If

 

MsgBox strMsg

End Sub

Back to top

WasBuildSuccessful

The WasBuildSuccessful method returns true if the last build completed successfully.

Syntax

WasBuildSuccessful() As Boolean

Example

The following example builds a hierarchy and displays the results.

Sub

GrpBuilder.StartBuildingHierarchy "CYGDEMO.GRP", "Navigation Hierarchy"

 

While GrpBuilder.IsBuilding()

WScript.Sleep(100)

Wend

 

Dim strMsg

If GrpBuilder.WasBuildSuccessful() Then

strMsg = GrpBuilder.GetBuildResults()

Else

strMsg = "Build failed for the following reason(s):" + vbCr + vbCr

strMsg = strMsg + GrpBuilder.GetBuildResults()

End If

 

MsgBox strMsg

End Sub

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.