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: 
nikhilgandhi715
Contributor III
Contributor III

Macro to check for "No data available" Error

Hi All,

I have a macro using which I am exporting some objects to powerpoint.

I dont want the graphs to be exported where there is no data to display. Can anyone help me with this?

Thanks in advance.

Nikhil.

1 Solution

Accepted Solutions
marcus_sommer

No data available isn't a error - it meant there isn't any data in your object for your certain selection. Therefore you need another approach. A very simply way is to count/sum the main-calculation from your object in a variable and if the result is greater then 0 then there are data available.

var CheckData = if(sum(VALUE) > 0, true(), false())

If ActiveDocument.Variables("CheckData").GetContent.String = true Then

    'your Export

else

     'nothing

End If

- Marcus

View solution in original post

2 Replies
marcus_sommer

No data available isn't a error - it meant there isn't any data in your object for your certain selection. Therefore you need another approach. A very simply way is to count/sum the main-calculation from your object in a variable and if the result is greater then 0 then there are data available.

var CheckData = if(sum(VALUE) > 0, true(), false())

If ActiveDocument.Variables("CheckData").GetContent.String = true Then

    'your Export

else

     'nothing

End If

- Marcus

nikhilgandhi715
Contributor III
Contributor III
Author

Hi Marcus,

Thanks for the details.

It is working...

In my case I had changed the code a bit. I am using 3 expressions so have created 3 variables and checked if the value is > 0 then export the graph else not.

sub TestData

Set v = ActiveDocument.Variables("vExp1")
vMyExp1 = v.GetContent.String

Set v = ActiveDocument.Variables("vExp2")
vMyExp2 = v.GetContent.String

Set v = ActiveDocument.Variables("vExp3")
vMyExp3 = v.GetContent.String

if vMyExp1 = "0" and vMyExp2 = "0" and vMyExp3 = "0" Then
Msgbox "Do Not Export to Powerpoint"
Else
Msgbox "Export to Powerpoint"
End if

End sub

Thanks for the support.