how to Sort calculated columns with coding

Stimulsoft Reports.NET discussion
so29
Posts: 72
Joined: Mon Nov 02, 2009 1:29 pm

how to Sort calculated columns with coding

Post by so29 »

Hello
How can sort the calculated column ؟

DataBand1.Sort = new string[2]
{
"ASC",
"Name"
};

I use the above code
I can sort the columns
But no calculated column
:brick:

Please guide me
Thank you

Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

how to Sort calculated columns with coding

Post by Jan »

Hello,

Please use following format:

Code: Select all

            ASC
            {Customers.CustomerID2}
          
Thank you.
so29
Posts: 72
Joined: Mon Nov 02, 2009 1:29 pm

how to Sort calculated columns with coding

Post by so29 »

Hello

Where to use
begin render Event ?
Please Give more explanation

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

how to Sort calculated columns with coding

Post by Alex K. »

Hello,

You can use the following code in Begin Render events of report:

Code: Select all

DataBand1.Sort = new string[2]
{
"ASC",
"ColumnName"
};
Thank you.
so29
Posts: 72
Joined: Mon Nov 02, 2009 1:29 pm

how to Sort calculated columns with coding

Post by so29 »

Aleksey wrote:Hello,

You can use the following code in Begin Render events of report:

Code: Select all

DataBand1.Sort = new string[2]
{
"ASC",
"ColumnName"
};
Thank you.
Hello

I've used the same code
But this code does not sort calculated column

Thank you

so29
Posts: 72
Joined: Mon Nov 02, 2009 1:29 pm

how to Sort calculated columns with coding

Post by so29 »

Jan wrote:
Please use following format:

Code: Select all

            ASC
            {Customers.CustomerID2}
          
.
Hello,

Please tell where and how this code should I use :dumb:

Thank you
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

how to Sort calculated columns with coding

Post by Alex K. »

Hello,

Code: Select all

DataBand1.Sort = new string[2]
{
"ASC",
"ColumnName"
};
To make this code work, it is necessary to embed it before compilation, because data should be calculated by calculated columns.

Thank you.
so29
Posts: 72
Joined: Mon Nov 02, 2009 1:29 pm

how to Sort calculated columns with coding

Post by so29 »

Aleksey wrote: To make this code work, it is necessary to embed it before compilation, because data should be calculated by calculated columns.
Hello,
I am using the Begin event rendering
Unfortunately will not work correctly

:tire:

Please Give more explanation

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

how to Sort calculated columns with coding

Post by Alex K. »

Hello,

Use the following code in your application:

Code: Select all

StiReport report = new StiReport();
report.Load(@"D:\Report.mrt");
Stimulsoft.Report.Components.StiDataBand band = report.GetComponents()["DataProducts"] as Stimulsoft.Report.Components.StiDataBand;
band.Sort = new string[2] { "DESC", "{Products.Column}" };
report.Compile();
report.Show();
Thank you.
so29
Posts: 72
Joined: Mon Nov 02, 2009 1:29 pm

how to Sort calculated columns with coding

Post by so29 »

Hello,
Thank you

Please note this
calculated column made in report page
Not in the application


May
About code guide

Code: Select all


            ASC
            {Customers.CustomerID2}
          

Thank you
Post Reply