Page 1 of 1

show column report with select user

Posted: Tue Sep 14, 2010 6:44 am
by s_mokhtari
hi
i three checkbox
1-id
2-name
3-address
when user select column when select checbox address report then show only field address
or select id,name show report only field id , name
thanks:kiss: :kiss:

show column report with select user

Posted: Tue Sep 14, 2010 6:53 am
by Alex K.
Hello,

Please see the sample report in attachment.

Thank you.

show column report with select user

Posted: Wed Sep 15, 2010 1:51 am
by s_mokhtari
hi
thanks from file
very good
but i want form chechbox in doesnt in report and this form disign in c#
and report havent any form
thanks
:grinder: :feelgood:

show column report with select user

Posted: Wed Sep 15, 2010 5:22 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

            StiReport report = new StiReport();
            report.Load(@"E:\SampleSelectingColumnsReport.mrt");
            StiText textProductID = report.GetComponents()["textProductID"] as StiText;
            textProductID.Enabled = true;

            StiText textProductName = report.GetComponents()["textProductName"] as StiText;
            textProductName.Enabled = false;

            StiText textSupplierID = report.GetComponents()["textSupplierID"] as StiText;
            textSupplierID.Enabled = true;

            StiText textCategoryID = report.GetComponents()["textCategoryID"] as StiText;
            textCategoryID.Enabled = false;

            StiText textQuantityPerUnit = report.GetComponents()["textQuantityPerUnit"] as StiText;
            textQuantityPerUnit.Enabled = false;

            StiText textUnitPrice = report.GetComponents()["textUnitPrice"] as StiText;
            textUnitPrice.Enabled = false;

            StiText textUnitsInStock = report.GetComponents()["textUnitsInStock"] as StiText;
            textUnitsInStock.Enabled = true;

            double width = 0;

            StiDataBand DataBand1 = report.GetComponents()["DataBand1"] as StiDataBand;
            foreach (StiComponent comp in DataBand1.Components)
            {
                if (comp.Enabled) width += comp.Width;
            }

            double factor = width / DataBand1.Width;

            foreach (StiComponent comp in DataBand1.Components)
            {
                if (comp.Enabled) comp.Width /= factor;
            }

            report.Show();
Thank you.

show column report with select user

Posted: Wed Sep 15, 2010 8:06 am
by s_mokhtari
hello
very beautiful your code
thanks a lot of
but add this code

Code: Select all

 StiHeaderBand  h = stiReport2.GetComponents()["HeaderDataSource1"] as StiHeaderBand ;
            foreach (StiComponent comp in h.Components)
            {
                if (comp.Enabled) comp.Width /= factor;
            }
but headers in report dont correctly positions
how design this headers that correctly
thanks a lot of :feelgood: :feelgood:

show column report with select user

Posted: Thu Sep 16, 2010 3:33 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

StiReport report = new StiReport();
report.Load(@"E:\SampleSelectingColumnsReport.mrt");

StiText textProductID = report.GetComponents()["textProductID"] as StiText;
StiText headerProductID = report.GetComponents()["headerCategoryID"] as StiText;
textProductID.Enabled = true;
headerProductID.Enabled = true;

StiText textProductName = report.GetComponents()["textProductName"] as StiText;
StiText headerProductName = report.GetComponents()["headerProductName"] as StiText;
textProductName.Enabled = false;
headerProductName.Enabled = false;

StiText textSupplierID = report.GetComponents()["textSupplierID"] as StiText;
StiText headerSupplierID = report.GetComponents()["headerSupplierID"] as StiText;
textSupplierID.Enabled = true;
headerSupplierID.Enabled = true;

StiText textCategoryID = report.GetComponents()["textCategoryID"] as StiText;
StiText headerCategoryID = report.GetComponents()["headerCategoryID"] as StiText;
textCategoryID.Enabled = false;
headerCategoryID.Enabled = false;

StiText textQuantityPerUnit = report.GetComponents()["textQuantityPerUnit"] as StiText;
StiText headerQuantityPerUnit = report.GetComponents()["headerQuantityPerUnit"] as StiText;
textQuantityPerUnit.Enabled = false;
headerQuantityPerUnit.Enabled = false;

StiText textUnitPrice = report.GetComponents()["textUnitPrice"] as StiText;
StiText headerUnitPrice = report.GetComponents()["headerUnitPrice"] as StiText;
textUnitPrice.Enabled = false;
headerUnitPrice.Enabled = false;

StiText textUnitsInStock = report.GetComponents()["textUnitsInStock"] as StiText;
StiText headerUnitsInStock = report.GetComponents()["headerUnitsInStock"] as StiText;
textUnitsInStock.Enabled = true;
headerUnitsInStock.Enabled = true;

double width = 0;

StiDataBand DataBand1 = report.GetComponents()["DataBand1"] as StiDataBand;
foreach (StiComponent comp in DataBand1.Components)
{
    if (comp.Enabled) width += comp.Width;
}

double factor = width / DataBand1.Width;

foreach (StiComponent comp in DataBand1.Components)
{
    if (comp.Enabled) comp.Width /= factor;
}

StiHeaderBand HeaderBand1 = report.GetComponents()["HeaderBand1"] as StiHeaderBand;
foreach (StiComponent comp in HeaderBand1.Components)
{
    if (comp.Enabled) comp.Width /= factor;
}

report.Show();
Thank you.

show column report with select user

Posted: Thu Sep 16, 2010 7:57 am
by s_mokhtari
hello
thanks a lot of your code
very good
but i delete this code because when user show only one col this col width change
i dont change width col

Code: Select all

double width = 0;

StiDataBand DataBand1 = report.GetComponents()["DataBand1"] as StiDataBand;
foreach (StiComponent comp in DataBand1.Components)
{
    if (comp.Enabled) width += comp.Width;
}

double factor = width / DataBand1.Width;

foreach (StiComponent comp in DataBand1.Components)
{
    if (comp.Enabled) comp.Width /= factor;
}

StiHeaderBand HeaderBand1 = report.GetComponents()["HeaderBand1"] as StiHeaderBand;
foreach (StiComponent comp in HeaderBand1.Components)
{
    if (comp.Enabled) comp.Width /= factor;
}
then i want this cols in center report how have one col
thanks a lot of

show column report with select user

Posted: Thu Sep 16, 2010 8:15 am
by Alex K.
Hello,

In this case you can make verification. If only one column remained, then the width is not changed.

Thank you.