IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
How can a single requirement be retrieved using the VB.Net SDK?
The sample VB.net code below uses a new techique to obtain a single requirement object using the SDK. This technique can be employed to prevent Java Heap memory issues when retrieving requirements from large CaliberRM databases. The code uses the new method "AllProjectIDs", details of this can be found in the following solution
How can a single project be retrieved using the VB.Net SDK?
The new SDK has a new method called "getRequirements", this method returns a CaliberRM collection of CaliberRM requirement object which then can be used to obtain a single requirement. The method syntax is as follows
Public Function getRequirements(projectID as CaliberRM.ProjectID, baseLineID as CaliberRM.BaselineID, requirementIDs as CaliberRM.Collection)
Sample VB.net Code
Dim collectionfactory As CaliberRM.CollectionFactory Dim myreqcollection As CaliberRM.Collection Dim req As CaliberRM.Requirement Dim serialnumber as Integer
"obtain project my_project = my_session.getProject(allprojids(0))
"Obtain current baseline ID BID = my_project.CurrentBaseline.BaselineID
"Create a collection for the requirement serial number collectionfactory = New CaliberRM.CollectionFactory mycollection = collectionfactory.Create()
"add serial number to collection mycollection.Add(serialnumber)
"Create collection to hold requirements Dim myreqcollection As CaliberRM.Collection myreqcollection = collectionfactory.Create()
"technique to obtain requirement object For r = 0 To mycollection.Count - 1 myreqcollection = my_session.getRequirements(allprojids(0), BID, mycollection)
req = myreqcollection.Item(0) Debug.Print(req.Name)
Next