Easy Chart - Binding to a join select sentence

Hi guys.
I have a general question regarding the Easy Chart component. The data that i want to display in the chart is a result of a complex join SQL sentence.

Is it possible to give the chart such a select sentence. As far as i can see it is only possible to choose one column from one table from one database for each pen.

What about giving it a stored procedure?
Is my only option to use the other charts?

Regards
Kamal

Kamal,
What SQL database are you using? You can create an SQL view that will flatten your query. If you post your query I’ll be able to provide a specific response.

What are you trying to accomplish with the stored procedure?

Hi
Thanks for your fast reply.

I am using a MS SQL 2005 Enterprise edition.

I have thought about using views. I could see that it was among the possible choices inside the chart module and then add some more Where clauses to pin out the data i want. I tried it out and works but Views have their limitations.

The stored procedure will just give a greater freedom regarding using parameters.

The reason why i was asking for the stored procedure is because in the “old” curve module i could use an AS in my SQL select sentence and in that AS i would specify the coloum names which were automatically used as legend names of the tags on the curve :slight_smile: . This is ideal for me as the application is multi lingual (and so are their textual tags). Do you have an idea of how to solve that with Views?

The second reason for using the stored procedures is to have a clean cut between the database and PMI.

Is it impossible to give the Easy Chart a stored procedure? Do i have to use views as a work around.

Is it possible to reach the tag names in the curve legend in another way. Some kind of SetProperty call.

/Kamal Lang

Kamal,
The pens themselves are stored in the Pens dataset - it’s an expert property of the Easy Chart. Note that you have a separate NAME versus COL_NAME property. You can bind the Pens dataSet to an SQL query that will return a different pen name based on the selected language. The customizer is merely a convenient way of modifying this dataSet.

I’ll look into stored procedures and update this post.

Kamal,

First, the “bad” news:

The Easy Chart writes your SQL for you. Thats the “easy” part about it! As such, it will be difficult (impossible?) to feed it a stored procudere for pen data. I am not very familiar with SQL Server - could you please post an example of how you would call the stored procedure? There might be a way…

Now, the “good” news:

Yes, you can get at the pen names. In fact, this is probably the way to go. The technique I’m going to describe would be much cleaner for a multi-lingual application, and it maintains the “clean cut” between PMI and the database.

The key concept here is that your Easy Chart pen configuration is stored in a DataSet property of the chart (See the chart’s “expert” properties). As such, you can put your pen definitions in the database. Even better, this lets you specify (in the database) pen names for different languages. Here is an example. You could make a pen table with the following definition (Note - this isn’t precise SQL syntax, but you should get the picture):

PenTable
PenID INTEGER
COL_NAME VARCHAR
TABLE_NAME VARCHAR
XVAL_COL_NAME VARCHAR
AXIS VARCHAR
SUBPLOT INTEGER
(etc… see “Pens” dataset on an easychart for all pen attributes. feel free to omit attributes that you want to leave at the default. Note that the NAME column is missing - read on)

PenNameTable
PenID INTEGER REFERENCES PenTable(PenID)
LangName VARCHAR (example: “en” or “dk”)
LocalizedPenName VARCHAR

Now bind the easy chart’s “pen” dataset to a query like

SELECT L.LocalizedPenName as NAME, P.* FROM PenTable P JOIN PenNameTable L ON P.PenID=L.PenID WHERE L.LangName = '{path.to.local.language}'

Tada - externally defined localized pen names, you just have to set the language as a property in the application. I have assumed a high level of SQL knowledge in this description, let me know if something isn’t clear.

Hope this helps,

Hi
Great!!.
I saw that the Easy Chart data set could be bind to a Database source, but i didn’t dare overwrite such a big data set.

Well i could call my stored procedures after all. But i will have to combine it with the pen table you sketched. I would then just bind the data set to a "EXEC spo_GetPenDataSet [Langauge], … " stored procedure. So no really bad news after all.

Thanks

Great! Yes, the EasyChart’s ability to have a dynamic pen set is very very handy for advanced requests like this.

Note that the queries that drive your pens’ data will still be generated by the EasyChart in the form SELECT XVAL_COL_NAME, COL_NAME FROM TABLE_NAME [where clause]