Highlighted
Absent Member.. Absent Member..
Absent Member..
491 views

Workflow with some OTA script nor working

Jump to solution

Hello Collegues.

 

Got an issue with ALM 12 OTA scripts in workflow:

In release management part of Worflow i need to query some Requirements and update their fields:

 

Checked up on forum and found a good solution offered in this topic

 

Though my part of code below fails to work:

     RLS_ID = Release_Fields.Field("REL_ID").Value

     Dim ReqConnection
     Dim RCLReqFilter
     Dim RCLReqList
     Dim RCLReqCount
     Dim RCLReqRec
     Dim RCLReqRecId

     'Connect
     set ReqConnection = TDConnection.ReqFactory

     'Filter Reqs by field Target_Rel containind RLS_ID
     set RCLReqFilter = ReqConnection.Filter
     RCLReqFilter.Filter("RQ_TARGET_REL")= RLS_ID
     set RCLReqList = RCLReqFilter.NewList()
     debug.print RCLReqList
     set RCLReqCount = RCLReqList.Count()

     MsgBox ("Req Count is " & RCLReqCount)
...

Eventually the NewList is not generated. And Count is not performed.

 

Any ideas how it can be resolved?

 

Regards

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Do you have an "On Error Resume Next" statement in your sub, before the excerpt you're showing ? When the workflow does not give you the expected results, it's a good idea to comment out such statements until your debugging is over.

 

I can see at least two potential problems in the piece of code you're showing :

 

1. debug.print is not something that you can use in the workflow (it belongs to VBA, i.e. the macro language for MSOffice products). This will generate an error.

 

2. The Count property of a List is a numeric property. As a numeric, you must not use the Set keyword. As a property, you must not use parenthesis. Thus a more correct sentence would be

RCLReqCount = RCLReqList.Count

 

View solution in original post

5 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Do you have an "On Error Resume Next" statement in your sub, before the excerpt you're showing ? When the workflow does not give you the expected results, it's a good idea to comment out such statements until your debugging is over.

 

I can see at least two potential problems in the piece of code you're showing :

 

1. debug.print is not something that you can use in the workflow (it belongs to VBA, i.e. the macro language for MSOffice products). This will generate an error.

 

2. The Count property of a List is a numeric property. As a numeric, you must not use the Set keyword. As a property, you must not use parenthesis. Thus a more correct sentence would be

RCLReqCount = RCLReqList.Count

 

View solution in original post

Highlighted
Absent Member.. Absent Member..
Absent Member..

Hello Chris.

Thanks for answer.

 

0) On Error Resume Next is sommented out, give no result or any messages.


1) Debug.print was used instead of MSgBox in vain effort to catch any error that is poped out. Removed it.

 

2) Checked the script without 'Set' parenthesis. Same result. No Req are counted though I see that at least 1 Req is linked to Release (have it's number in Target Release field).

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Although the RQ_TARGET_REL column of the database holds the ID 's of the target release(s), you do not specify that ID in the TDFilter.Filter property.

 

You'd have to specify something like "^Releases\2015\Version 12.20^", i.e. the full path of the release surrounded by ^ characters.

 

As a general rule, the values that you can use for the TDFilter.Filter properties are the same as the ones you can see when you set a filter in ALM, copy it to the clipboard and paste it to any text editor. In this case :

 

[Filter]{
TableName:REQ,
ColumnName:RQ_TARGET_REL,
LogicalFilter:\0000001D\^Releases\2015\Version 12.20^,
VisualFilter:\0000001D\^Releases\2015\Version 12.20^,
NO_CASE:
}

 

Note that this tip gives you both the column name and the value.

Absent Member.. Absent Member..
Absent Member..

Ah that can be an issue I guess.
So the Filter operand works not with column content ie ID of release but rather with the Name of the Release that is displayed in the UI?

As i know Target Release field contained the ID value of the release to which Requirement is linked.

I'll check that idea today and see if it works.
Thanks again Chris.

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

And so it works that way for ALM 12.20:

  'Declaring variables for script
     'RLS_ID - id of active release

     Dim RLS_ID, BG_IDs, RQ_IDs
     'Set RLS_ID to current Release
     RLS_ID = Release_Fields.Field("REL_ID").Value

     'Debug message
     MsgBox "Current Release is: " & RLS_ID

     'OTA usage try below
     Dim ReqConnection
     Dim RCLReqFilter
     Dim RCLReqList
     Dim RCLReqCount
     Dim RCLReqRec
     Dim RCLReqRecId

     'Connect
     MsgBox "10"
     set ReqConnection = TDConnection.ReqFactory
     MsgBox "20"
     'Filter Reqs by field Target_Rel containind RLS_ID
     MsgBox "30"
     set RCLReqFilter = ReqConnection.Filter
     MsgBox "40"
     RCLReqFilter.Filter("RQ_TARGET_REL")= RLS_ID
     MsgBox "50"
     'RLS_ID
     set RCLReqList = RCLReqFilter.NewList

     MsgBox "60"
     RCLReqCount = RCLReqList.Count

     MsgBox "70"
     MsgBox ("Req Count is " & RCLReqCount)

Filter works with ID not the Name of the release.

Now it correctly returns number of linked Requirements.
Thank Chris for pointing that SET was unnesscessary in code.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.