Page 1 of 2
How to sort use meth in report's form?
Posted: Sun Aug 22, 2010 11:09 pm
by RickyHuang
this is my code in report form's button click event
string var;
var = "";
foreach (StiRadioButtonControl obj in PanelControl2.Components)
{
if(obj.Checked)
{
var = obj.Name;
break;
}
}
if (RadioButtonControl1.Checked)
{DataCS210.Sort = new System.String[] {
"ASC",
var};
}
else
{DataCS210.Sort = new System.String[] {
"DESC",
var};
}
obj.Name is my DataSource.DataColumn's Name
But now,I want to sort by meth,it's like ds.A + ds.B
If i use the meth in sort tab in report's databand,it can work,but use it in form's button event,it cant work.
How to do it?
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 2:37 am
by Alex K.
Hello,
If "var" is the calculated column for your data sources then it will not be possible to do this because for calculated columns the sorting should be added before compilation of reports. If these are not calculated columns then, please see a report sample how to do this.
Thank you.
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 3:17 am
by RickyHuang
If it is not a column,it just is a function,can it work ?
like this
DataCS210.Sort = new System.String[] {
"ASC",
"ds.A + ds.B"};
or
next realease will add this feature?
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 4:18 am
by Alex K.
Hello,
If we understand you task correctly you can use:
DataCS210.Sort = new System.String[] {
"ASC",
"ds.A",
"ASC",
"ds.B"};
Thank you.
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 4:26 am
by RickyHuang
ex:
Coke----FrenchFries----Total
100------50--------------150
I want sort by total,and toal not is a calculated column ,I use this function in 『Coke + FrenchFires』to sort it in report in sort tab,it can work...
can i use it in report's form,too?
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 4:42 am
by Alex K.
Hello,
Please see the sample report in attachment.
Thank you.
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 5:24 am
by RickyHuang
thanks ,I test it in my report, but it's not work
1. It's not work <-----I want sort like 『iif(true,ds.A*10,ds.A/10)』
DataCS210.Sort = new System.String[] {
"ASC",
"ds.A * 10"};
2. It's not work
DataCS210.Sort = new System.String[] {
"ASC",
"ds.A"};
3.1. It's work
DataCS210.Sort = new System.String[] {
"ASC",
"A"};
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 6:13 am
by Alex K.
Hello,
You need add two metods:
public class Report : Stimulsoft.Report.StiReport
{
public object GetData_Sort1()
{
return ds.A * 10;
}
public object GetData_Sort2()
{
return ds.A / 10;
}
public Report()
{
this.InitializeComponent();
}
#region StiReport Designer generated code - do not modify
......
and in report form's button click event:
string var;
var = "";
foreach (StiRadioButtonControl obj in PanelControl2.Components)
{
if(obj.Checked)
{
var = obj.Name;
break;
}
}
if (RadioButtonControl1.Checked)
{DataCS210.Sort = new System.String[] {
"ASC",
"{GetData_Sort1}"};
}
else
{DataCS210.Sort = new System.String[] {
"DESC",
"{GetData_Sort2}"};
}
Thank you.
How to sort use meth in report's form?
Posted: Mon Aug 23, 2010 7:38 pm
by RickyHuang
I know,i had view the code page.
but i dont know how to key in
thanks for your sample
now i know how to do it.
How to sort use meth in report's form?
Posted: Tue Aug 24, 2010 12:15 am
by Alex K.
Hello,
Let us know if you need any additional help.
Thank you.