EasyChart : write SQL Query myself

Hello,

I have an easy chart and I want it to display only a few points from my table. I don’t want it to display every grid line, but only every second or third… grid line of the table. Here is the SQL query of what I want to do:

SELECT * FROM ( SELECT myValue, myDate, ROW_NUMBER() OVER (ORDER BY myDate) AS count FROM myTable ) x WHERE x.count % 2 = 0

And here is the result:

-6,499901 2013-11-07 20:00:00.000 2 1558,476 2013-11-07 20:00:00.000 4 101,4985 2013-11-07 20:00:00.000 6 -19,4997 2013-11-07 20:00:00.000 8 54,49917 2013-11-07 20:00:00.000 10 28,49957 2013-11-07 20:00:00.000 12 62,49905 2013-11-07 20:00:00.000 14 64,49902 2013-11-07 20:00:00.000 16 -6,499901 2013-11-07 20:10:00.000 18 1556,476 2013-11-07 20:10:00.000 20 101,4985 2013-11-07 20:10:00.000 22

So my questions are:

  • Can I write directly this SQL query somewhere in my Easy chart? (doesn’t work when I write it on the SQL Query section of the DBPens)
  • Can I put this query in a simple table, and then “call” the table in my chart?
  • Or can I use tags to do this?

(in fact I just want an easy way to display this sql query in a chart)

Thank you in advance!

Hi Lisa. Hope all is well with you!

Have you tried this query on a standard chart, yet? If you can bind it to the Data property, it may give you what you are looking for.

There have been occasions where I’ve had to “create” my own easy chart when the stock one couldn’t quite fit what I needed it to do.

Thanks for the help!

Indeed I have tried this query on a classic chart too but it doesn’t seem to work (no error message, but there isn’t any data displayed, the chart is blank). I’m probably doing something wrong but I can’t get what… But if you say it is possible to get what I want to do with a standard chart I will try to work on it, thank you!
So it isn’t possible to do it in an easy chart? (use a custom SQL query)

[quote=“LisaCourant”]Thanks for the help!

So it isn’t possible to do it in an easy chart? (use a custom SQL query)[/quote]

I don’t believe so. The easy chart is great for 98% of all things asked of it. It’s just that 2% of “non-standard” queries that I (and now you, apparently :wink: ) like to use.

Ok, too bad for us! Thank you very much, I can now display the result of my query, the problem was just the order of my “SELECT” fields (“SELECT *” wasn’t good, I just changed it for “select myDate, myValue” and everything seems to be ok). :slight_smile:
One last question : can I bind the min date and max date of my chart to something, like a “date range” component?

Yes, you can! In fact you can also use tags, if you were of a mind to do so.

On the right-hand side of the dialog box, where you set the query, there are buttons for properties and tags.

Just be sure you remember to enclose the property name in single quotes. I say it from experience because I usually forget. :laughing:


Oh ok, I have to put it directly into the query! I was looking for a field “start/end date” in the Chart component, maybe that’s why I couldn’t find it.
Thanks a lot for all your help, it has been really useful! :slight_smile: