Ticket Q451551
Visible to All Users

Change data in Dashboard

created 12 years ago

Hi…
 Have been working with your Dashboard and is quite impressed with it ́s features - however a problem has shown itself here.
I ́ve made a Dashboard who gets it ́s data from sql-server, and saved it ́s layout, and upon loading, it is shown perfectly.
But then I wanted to be able to add a "filter" or criteria based on user selected category. This gives me some problems :-(
ìve put a splitcontainer control with a grid on the one side, and the dashboard on the other, and my plan was when the user selected a row in the grid, the dashboard would be updated with the selection as criteria / filter.
I ́ve loaded the new data into a datatable/dataset, but when I try to put this in the dashboards data with the command:
         Me.DashboardViewer1.Dashboard.DataSources(0).Data = Data
I keep getting the error: "Data cannot be assigned if a data provider is used" and this I do not understand, as it is a table from the same sql-database table, only with data reflecting what the user selected (only one group not all as is loaded when the form is shown)
Then I tried another approach to get the job done:
            Me.DashboardViewer1.Dashboard.DataSources.Clear()
            Me.DashboardViewer1.Dashboard.AddDataSource("Data", Ds.Tables("Datatabel"))
And this didn ́t produce any errors, but i neither produced any data in the dashboard, as all items were cleared and showed nothing anymore.
Is the datasource for Dashboard static, or is there a way that I can provide new data for the dashboard ? Or is there a way that I can (through code) can pass a filter to the viewer, like ActiveFilterstring in Gridview, i.e. "Group=1"
Hope you can help me
Regards,
Michael
PS. Have applied update/build with the fix with the ability to enter user/password for the sql-server datasource upon loading - and this was wonderfull :-)

Answers approved by DevExpress Support

created 12 years ago (modified 10 years ago)

Hi Michael,
Thank you for your kind words. I am happy to hear that you have found this fix helpful.
To update data within a dashboard item, assign a new data source to its DataSource property after you update the Dashboard.DataSources collection.
I have attached an example that shows how to do this.
Please also note that we have added the DashboardViewer.ReloadData method that allows you to accomplish this with a single call.
You can get a public fix that contains this method from the following page right now:
Usability - There is no public API for reloading data from database
Thanks,
Basil

    Show previous comments (5)
    DevExpress Support Team 12 years ago

      Thank you for your suggestion. We appreciate your input. We will take your comments into account when scheduling our development.
      With the current dashboard version, it is possible to accomplish this task without additional event handlers. You can use the following code:

      C#
      dashboardDesigner.OpenDashboard("test.xml"); dashboardDesigner.Dashboard.DataSources.FindFirst(ds => ds.Name == "DS").Data = data;

      or

      C#
      Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml("test.xml"); dashboard.DataSources.FindFirst(ds => ds.Name == "DS").Data = data; dashboardDesigner.Dashboard = dashboard;

      Note that in the latter case, it is necessary to dispose of the Dashboard manually.

      DevExpress Support Team 12 years ago

        This behavior with cell alignment looks like a bug. So, I have registered a separate report: Dashboard Grid numeric cells have incorrect left alignment

        DevExpress Support Team 12 years ago

          Thank you for your cooperation. I have made this report public.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.