Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to export formula with Set analysis using macro

I need to export the value of this formula in an excel . Formula contains set analysis.

When I try to export formula it doesn't recognize the set analysis..can anybody please help?

testresult = activedocument.Evaluate("num(only({<Last8WeeksReferencedateOpened = {"$(=max(Last8WeeksReferencedateOpened))"}>}Aggr($(vAging_Incidents_weekly),Last8WeeksReferencedateOpened)),'#0.00')")

msgbox testresult

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

1. create a variable e.g vTest

=num(only({<Last8WeeksReferencedateOpened = {"$(=max(Last8WeeksReferencedateOpened))"}>}Aggr($(vAging_Incidents_weekly),Last8WeeksReferencedateOpened)),'#0.00')


2. Change Macro to:

sub test

testresult = activedocument.Evaluate("vTest")

msgbox(testresult)

end sub

View solution in original post

2 Replies
Frank_Hartmann
Master II
Master II

1. create a variable e.g vTest

=num(only({<Last8WeeksReferencedateOpened = {"$(=max(Last8WeeksReferencedateOpened))"}>}Aggr($(vAging_Incidents_weekly),Last8WeeksReferencedateOpened)),'#0.00')


2. Change Macro to:

sub test

testresult = activedocument.Evaluate("vTest")

msgbox(testresult)

end sub

Anonymous
Not applicable
Author

I used the following

set testresult = ActiveDocument.Variables("vAging_WeeklyReport_LastWeek")

testresult= testresult.getcontent.string

testresult = activedocument.evaluate(testresult)