HP ALM

This category is a parent category in order to collect all sub categories and according articles.

Below method gets any row from a provided Microsoft Excel worksheet as a String array. This can be quite handy, if you for example want to get all field names from a worksheet.

Source Code

The code references a Microsoft Excel API. It automates Excel in a background process and therefore requires Excel to be running as well as the parent workbook of a handed worksheet to be opened before calling this function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
' @Author - Alexander Bolte
' @ChangeDate - 2014-12-11
' @Description - Returns the header row of a provided Excel.Worksheet object
' as a zero based String() Array.
' @Param worksheet - an Excel.Worksheet object of an Excel.Workbook, 
' which has been opened before calling this function. 
' @Param row - a Long indicating the row, which field headers
' should be read from.
' @Returns a zero based String() Array containing the field header names.
' @Remarks - The method starts always in column one in a handed worksheet.
Function getExcelHeader(workSheet, row) ' As String()
  Dim c ' As Integer
  Dim header ' As String()
  Dim importRng ' As Range
 
  Set importRng = workSheet.UsedRange
  ReDim header(importRng.Columns.Count - 1)
  For c = 0 to UBound(header)
      header(c) = cStr(workSheet.Cells(row,c + 1).Value)
  Next ' column in worksheet.
  Set importRng = Nothing
 
  getExcelHeader = header
End Function

The following method allows you to save a Microsoft Excel file to a users hard disc.

Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
' @Author - Alexander Bolte
' @ChangeDate - 2015-01-05
' @Description - Saves provided excel file under given file path.
' Overwrites any existing file in same directory with same name.
' @Param xlFile - An object of type Excel.Workbook.
' @Param trgPath - A String holding a path to save a provided file to.
' @Returns true, if a provided excel file has been saved successfully
' else false.
Function saveXlFile(xlFile, trgPath) ' As Boolean
  Dim ret ' As Boolean
  Dim fso ' As Scripting.FileSystemObject
 
  On Error Resume Next
 
  ' Delete file if it already exists.
  deleteFileOnHD trgPath
  ' Save provided file under given file path.
  xlFile.SaveAs trgPath
  ret = True
 
  If Err.Number <> 0 Then
    Err.Clear
  End If
 
  saveXlFile = ret
End Function

 

Referenced Methods

Below list shows references to other methods.

VBScript to delete file

I've developed quite a few complex reports in HP ALM for my clients over the past years and found it was a good idea to let power users implement SQL reports.

With version 11.x HP introduced business views, which replace not only Excel reports but apparently the whole Dashboard in HP ALM.

Although currently working with version 12.x of HP ALM, I see that you can use business views as basis for Excel reports or Charts and other online reports in the Analysis view of the ALM Dashboard.

This means you should think about migrating your existing SQL reports into business views.

Subcategories

This category is meant to hold all articles regarding HP ALM REST API.

This category will provide articles regarding usage of Visual Basic Script in the workflow module of HP ALM.