Page 1 of 1

Docs/tutorials for writing custom reports

Posted: Thu May 21, 2009 1:49 pm
by ksolito
Store owner would like some customized reports. For starters, one listing inventory by manufacturer, and another listing low inventory by manufacturer. I suspect more will be required in the future.

Are there any documents or threads about general reporting process and creating custom reports?

Re: Docs/tutorials for writing custom reports

Posted: Fri May 22, 2009 4:56 am
by mazhar
You can write new reports via writing your custom queries
http://wiki.ablecommerce.com/index.php/Custom_Queries

Also there are many code samples available in forums about data access, check
viewforum.php?f=47

Here are some mods discussed in reports
viewtopic.php?f=44&t=9101
viewtopic.php?f=44&t=8713
viewtopic.php?f=42&t=8873
viewtopic.php?f=45&t=8496

Re: Docs/tutorials for writing custom reports

Posted: Tue Nov 10, 2009 4:34 pm
by ksolito
mazhar,

I viewed the sample on wiki but I am still unclear on how to retreive and process the sql query return.

I have something like this:

Code: Select all

       CommerceBuilder.Data.Database database = Token.Instance.Database;
       string sql = ("<my really comprehensive inventory query that is tested and debugged in SQL Mgmt Express>");
       using (System.Data.Common.DbCommand selectCommand = database.GetSqlStringCommand(sql))
       {
           database.ExecuteScalar(selectCommand);
I want to iterate through the returned data and build a report.

Re: Docs/tutorials for writing custom reports

Posted: Tue Jan 05, 2010 11:24 am
by vieodesign
Has anyone ever done a basic, step by step how-to for changing or adding a custom report? That would be wildly helpbul. In my case, I'm trying to follow the examples, but what in the world is the .aspx.cs file for? What does it do and do I need to create one (and how)?

Re: Docs/tutorials for writing custom reports

Posted: Wed Jan 06, 2010 5:05 am
by mazhar
vieodesign wrote:Has anyone ever done a basic, step by step how-to for changing or adding a custom report? That would be wildly helpbul. In my case, I'm trying to follow the examples, but what in the world is the .aspx.cs file for? What does it do and do I need to create one (and how)?
You need to call execture reader on you db command that will retrun you a reader to itterate over your returned data. For example

Code: Select all

using(IDataReader dr = database.ExecuteScalar(selectCommand))
{
while(dr.Read())
{
//Here read columns from current row read by reader like
int id = AlwaysConvert.ToInt(dr[0]);
string name = AlwaysConvert.ToString(dr[1]);
}
dr.Close();
}

Re: Docs/tutorials for writing custom reports

Posted: Wed Jan 06, 2010 5:08 am
by mazhar
vieodesign wrote:Has anyone ever done a basic, step by step how-to for changing or adding a custom report? That would be wildly helpbul. In my case, I'm trying to follow the examples, but what in the world is the .aspx.cs file for? What does it do and do I need to create one (and how)?
I think there was something about a custom report available at plugables.com, have a look at here
http://blog.plugables.com/tag/report/