cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
So you've built a beautiful dashboard but your user decides to use a filter combination that returns no rows. Sometimes it's not even your users, it may just be that you have a structure where not all charts should have data returned. To account for the case when No Rows Returned, we can lean on Python to do our "error" handling for us. To check for the No Rows Returned condition, all you have to do is add look for the df to have nothing.
df.size == 0
You can then add meaningful values, such as a blank string to be passed. That's what we did for this object where we built a dashboard with a chart for each major possible line item and account for it not being a part of the data returned.
# extract important variables
def extract(df):
  if df.size == 0:
    return ['N/A', '', '']
  else:
    current = str(prettify_num(df.iloc[0,1]))
    contract = str(prettify_num(df.iloc[0,0]))
    return [percent_difference(df), current, contract]
Version history
Last update:
‎03-02-2023 09:29 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: