Hello there, everyone.
This is Shubham. i am from india
I am learning something new, and I need your help.
i am working on a project, in which i am collecting input from the user (using data entry form) that data is stored in database (SSMS) (it has 20 columns)
So, i have created a view and added a prospective chart on it (its a view, not report)
lets say i have added a 'bar' or 'pie' chart and in this bar chart i wanted to show count of distinct value from status column (i have column named Status in my SSMS table)
How can I do that? please suggest solution or approach
(charts is to be real-time; if data is inserted/updated in table, charts must be populated immediately.)
Please let me know how I should approach this development.
Regards,
Shubham
This is pretty easy to do. Here are somethings you'll need:
- A Named Query that returns the Status and number of occurrences of that status, something like
StatusName | Count
Running | 12
Down | 5
Off | 6
- A view with a chart on it, either a Bar or Pie chart (or any chart)
- A Query binding on the charts
data
property that references your NQ above.
- On your form
Submit
button, a refreshBinding(self.data)
call to refresh the chart's data
binding every time you insert table data OR if the data form is in a popup, a message handler that will do the same thing.
So, the data flow would be like this:
User clicks Submit
-> data inserted to DB -> refreshBinding()
called on Chart's data
property that has the NQ binding
Default Pie chart:
You can copy the data[i]
formatting pretty much exactly, except instead of flavor
and count
, you can have something like status
and count
.