Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How is it possible to print a list of all my variables?
thx
Chris
Here we go:
http://qlikviewmaven.blogspot.com/2008/11/listing-all-variables-and-contents.html
a very smart Marco for EXECL
Sub List_QV_Variables()
'This Excel macro will ask you to select a QlikView Report File and
'then it will put the variable names and contents into your current worksheet
'--Tim Benoit, Nov 2008
Dim oQV, oRpt, oVars, oTempVar, oThisVar, qv_fn
'Get the QlikView report pathname
qv_fn = Application.GetOpenFilename("QlikView Report File (.),*.*", , "Select a QlikView .qvw Report File", False)
If qv_fn = 0 Then
Exit Sub
End If
'Write out some heading text
ActiveSheet.Cells(1, 1).Formula = "QlikView Variables List"
ActiveSheet.Cells(2, 1).Formula = "Report pathname:"
ActiveSheet.Cells(2, 2).Formula = qv_fn
ActiveSheet.Cells(3, 1).Formula = "Variable Name"
ActiveSheet.Cells(3, 2).Formula = "Variable Content"
'Open the QlikView report file
Set oQV = CreateObject("QlikTech.QlikView")
Set oRpt = oQV.OpenDoc(qv_fn)
Set oVars = oRpt.GetVariableDescriptions
'Loop through the variables
For i = 0 To oVars.Count - 1
Set oTempVar = oVars.Item(i)
varname = Trim(oTempVar.Name)
Set oThisVar = oRpt.Variables(varname)
varcontent = oThisVar.GetRawContent
'Write data into worksheet cells
ActiveSheet.Cells(i + 4, 1).NumberFormat = "@"
ActiveSheet.Cells(i + 4, 1).Formula = varname
ActiveSheet.Cells(i + 4, 2).NumberFormat = "@"
ActiveSheet.Cells(i + 4, 2).Formula = varcontent
Next
'Close QlikView
oRpt.CloseDoc
oQV.Quit
End Sub
Here we go:
http://qlikviewmaven.blogspot.com/2008/11/listing-all-variables-and-contents.html
a very smart Marco for EXECL
Sub List_QV_Variables()
'This Excel macro will ask you to select a QlikView Report File and
'then it will put the variable names and contents into your current worksheet
'--Tim Benoit, Nov 2008
Dim oQV, oRpt, oVars, oTempVar, oThisVar, qv_fn
'Get the QlikView report pathname
qv_fn = Application.GetOpenFilename("QlikView Report File (.),*.*", , "Select a QlikView .qvw Report File", False)
If qv_fn = 0 Then
Exit Sub
End If
'Write out some heading text
ActiveSheet.Cells(1, 1).Formula = "QlikView Variables List"
ActiveSheet.Cells(2, 1).Formula = "Report pathname:"
ActiveSheet.Cells(2, 2).Formula = qv_fn
ActiveSheet.Cells(3, 1).Formula = "Variable Name"
ActiveSheet.Cells(3, 2).Formula = "Variable Content"
'Open the QlikView report file
Set oQV = CreateObject("QlikTech.QlikView")
Set oRpt = oQV.OpenDoc(qv_fn)
Set oVars = oRpt.GetVariableDescriptions
'Loop through the variables
For i = 0 To oVars.Count - 1
Set oTempVar = oVars.Item(i)
varname = Trim(oTempVar.Name)
Set oThisVar = oRpt.Variables(varname)
varcontent = oThisVar.GetRawContent
'Write data into worksheet cells
ActiveSheet.Cells(i + 4, 1).NumberFormat = "@"
ActiveSheet.Cells(i + 4, 1).Formula = varname
ActiveSheet.Cells(i + 4, 2).NumberFormat = "@"
ActiveSheet.Cells(i + 4, 2).Formula = varcontent
Next
'Close QlikView
oRpt.CloseDoc
oQV.Quit
End Sub
Thank you for posting this!