Page 1 of 1
how to render dynamic columns
Posted: Tue Mar 05, 2013 2:14 am
by fjaweihyafie
now I have a UI like:(□ means checkbox)
□ column 1
□ column 2
□ column 3
when cilent check the colums (multi-selection) , such as column1 and column2 are checked , then my datasource will generate data of column1 and column2 , if column3 is checked , my datasource will generate data of column3 , the columns in datasource are depended on the UI which client checked .
My question is how can I make such a requirement in mrt . When I design in mrt , the layout is static and the data will be fill in the place I assigned . I hope the columns will be large enough with the page size ,whethe it is one column or more colums .
Thanks!
Re: how to render dynamic columns
Posted: Tue Mar 05, 2013 8:27 am
by Alex K.
Hello,
Please see the sample report in the attachment.
Thank you.
Re: how to render dynamic columns
Posted: Tue Mar 05, 2013 10:24 am
by fjaweihyafie
Aleksey wrote:Hello,
Please see the sample report in the attachment.
Thank you.
yep ! That's it , thanks very much !

Re: how to render dynamic columns
Posted: Tue Mar 05, 2013 10:25 am
by Alex K.
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Re: how to render dynamic columns
Posted: Wed Mar 27, 2013 10:07 am
by fjaweihyafie
Hi , Thanks for your help . It did work , but I had a problem that when then client get reports from UI (windows from created by mrt designer) it wroks well ( I added the code in click event as you suggested .) But I still had a utility to run report from promt (cmd.exe) , but in this condition it does not work . I added the code control the column' enable in beginrender (Report) and click (botton) both , I find the code occur in before render firest then click ,but it did not work in click event to change the enable property.
such as
Code: Select all
public void Report_BeginRender(object sender, System.EventArgs e)
{
string[] Period = ReportingPeriod.Split(new char[]{','});
foreach(string s in Period )
{
switch (s)
{
case "0" :
lblDaily.Enabled = true ;
txtDaily.Enabled = true ;
break;
case "1" :
lblMTD.Enabled = true;
txtMTD.Enabled = true;
break;
case "2" :
lblQTD.Enabled = true;
txtQTD.Enabled = true;
break;
case "3" :
lblYTD.Enabled = true;
txtYTD.Enabled = true;
break;
case "4" :
lblLTD.Enabled = true;
txtLTD.Enabled = true;
break;
}
}
double width = 0;
int i = 0;
foreach (StiComponent comp in DataBand1.Components)
{
if (comp.Enabled)
{
//width += comp.Width;
i++;
}
}
double factor = (DataBand1.Width - ( i - 1 ) * 0.1) / i ;
i = 0;
foreach (StiComponent comp in DataBand1.Components)
{
if (comp.Enabled)
{
comp.Width = factor;
comp.Left = i * 0.1 + i * factor;
i++;
}
}
i = 0;
foreach (StiComponent comp in HeaderBand1.Components)
{
if (comp.Enabled)
{
comp.Width = factor;
comp.Left = i * 0.1 + i * factor;
i++;
}
}
;
}
Code: Select all
public void btnOk_Click(object sender, System.EventArgs e)
{
ReportingPeriod = String.Empty;
if( ckbDaily.Checked )
{
ReportingPeriod +="0,";
}
if( ckbMTD.Checked )
{
ReportingPeriod +="1,";
}
if( ckbQTD.Checked )
{
ReportingPeriod +="2,";
}
if( ckbYTD.Checked )
{
ReportingPeriod +="3,";
}
if( ckbLTD.Checked )
{
ReportingPeriod +="4,";
}
if( ReportingPeriod.LastIndexOf(",") == ReportingPeriod.Length -1 )
{
ReportingPeriod = ReportingPeriod.Substring(0, ReportingPeriod.Length-1);
}
EffectiveDate = dtpEffDate.Value;
ContentDataSource.ConnectOnStart = true;
string[] Period = ReportingPeriod.Split(new char[]{','});
foreach(string s in Period )
{
switch (s)
{
case "0" :
lblDaily.Enabled = true ;
txtDaily.Enabled = true ;
break;
case "1" :
lblMTD.Enabled = true;
txtMTD.Enabled = true;
break;
case "2" :
lblQTD.Enabled = true;
txtQTD.Enabled = true;
break;
case "3" :
lblYTD.Enabled = true;
txtYTD.Enabled = true;
break;
case "4" :
lblLTD.Enabled = true;
txtLTD.Enabled = true;
break;
}
}
double width = 0;
int i = 0;
foreach (StiComponent comp in DataBand1.Components)
{
if (comp.Enabled)
{
//width += comp.Width;
i++;
}
}
double factor = (DataBand1.Width - ( i - 1 ) * 0.1) / i ;
i = 0;
foreach (StiComponent comp in DataBand1.Components)
{
if (comp.Enabled)
{
comp.Width = factor;
comp.Left = i * 0.1 + i * factor;
i++;
}
}
i = 0;
foreach (StiComponent comp in HeaderBand1.Components)
{
if (comp.Enabled)
{
comp.Width = factor;
comp.Left = i * 0.1 + i * factor;
i++;
}
}
;
}
I found only the Report_BeginRender work , the btnOk_Click worked but did not change the controls enable . If I just add the code in btnOK_Click when I use ultility I can get the result I need ....
How can I make it both affect or after Report_BeginRender and btnOk_Click ,the btnOK_Click will change the enable also.
Thanks .
Re: how to render dynamic columns
Posted: Wed Mar 27, 2013 10:33 am
by Alex K.
Hello,
Can you please send us a sample project which reproduce the issue for analysis.
Thank you.