Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get fieldvalues into a macro?

hi,

i use following macro to print a report and save a file as:

sub printRP04
reportFile = "c:" & "" & reportID & "_" & fieldID & "_" & reportName & ".pdf"
printReportPDF reportFile
ActiveDocument.PrintReport "RP12", "QlikViewPDF"
end sub
Function printReportPDF(pdfOutputFile)
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"
Set WSHShell = nothing
End function

now reportID, fieldID and reportName i want to replace against 3 actual selected fields so the file gets the right name to save......this is my first macro so i dont now how to get the fieldvalues into the macro......do i have to care about integer and string? because one of the fields will be an string? can anyone help me with the code and syntax?

regards

3 Replies
Not applicable
Author

Try this:

SET reportID = ActiveDocument.Fields("reportID").GetPossibleValues
If reportID.Count>0 Then
reportFile = "c:" & "\" & reportID.Item(0).Text
End IF


sparur
Specialist II
Specialist II

Hi, corleone.

Try this:


set mySelections= ActiveDocument.Fields("Field1").GetSelectedValues
for i=0 to mySelections.Count-1
set currentValue = mySelections.Item(i).text
next


Not applicable
Author

thx Mark 4 help........worked for me!