Skip to main content

How can we display a customized message if the data source returns no data in chart and table?

Comments

3 comments

  • Johnny Stevens

    Hey Seema,

    There is an undocumented token that is generated when you set a table to HideWhenZeroRows=True

    The token is @Data.rdHideTableRowCount-<table id here>~

    Assuming my table id is dt1, I would set dt1 to Hide When Zero Rows = True. Then I add a DIV element containing whatever message (img, label, link, etc.) I want to show when there are no results. The DIV will need the following condition: @Data.rdHideTableRowCount-dt1~=0

    Done!

    btw... Charts have their own "No Data Caption" attribute with a "No Data Caption Style" element that can be used to customize the look/feel.

    Here is a quick sample:

    <DataTable AccessibleHeaders="True" AccessibleSummary="DataTable" AjaxPaging="True" HideWhenZeroRows="True" ID="DataTable1" Layout="Fixed" RememberSort="True" SortArrows="True" TableBorder="0" Width="100" WidthScale="%" IdeDisplayStatus="Collapsed">
    datalayers...
    columns...
    etc...
    </DataTable>

    <Division Condition="@Data.rdHideTableRowCount-DataTable1~=0" HtmlDiv="True" ID="divNoResults" IdeDisplayStatus="Collapsed">
    <LineBreak LineCount="3" />
    <Label Caption="No results for your selections." Class="ThemeTextNegative" />
    </Division>
    0
  • Seema Verma

    Hii

    I have used the "No Data Caption" in the Chart canvas but its not working ,even though there is no data is available in data source. It shows the empty chart. Is there any restriction for this element?

    Can we solve this issue by adding some condition in div element as  like datatable.

    Thanks

    Seema

     

     

    0
  • Johnny Stevens

    HI Seema,

    For Chart No Data Caption, you can do 2 things:

    1. Set the Attribute in the ChartCanvas, set the No Data Caption element to the text you want to show, like "No Data Found" (with quotes removed)
    2. Use the ChartCanvas child "No Data Caption Style" element to control the styling of your text

    If this isn't showing anything, you may want to check the Debugger to confirm that nothing results from your Datalayer.

    Thanks,
    Johnny

    0

Please sign in to leave a comment.