Page 1 of 1

Dynamically Sorting

Posted: Sun Jan 02, 2011 6:30 pm
by Pete
How do you dynamically set the sorting of databands? Some of my reports will need to be sorted depending on what the user sorts. Is it possible to set what the report databands sort by when loading the report in flex?

Dynamically Sorting

Posted: Mon Jan 03, 2011 7:50 am
by Vladimir
Hello,

This functionality is already implemented and will be available in the prerelease build on January 4. In the attached archive you can see an example with dynamic sorting of the report.

Thank you.

Dynamically Sorting

Posted: Mon Jan 03, 2011 10:08 am
by Pete
Thanks! I'll wait until tomorrow to mess around with it=)

Dynamically Sorting

Posted: Tue Jan 04, 2011 3:08 am
by Vladimir
We always glad to help you!

Thank you.

Dynamically Sorting

Posted: Mon Mar 14, 2011 3:28 pm
by jorool
Hello,

Can someone tell me how to sort databands by multiple fields from code correctly?
I'm trying this, without success:

Code: Select all

var banda:StiDataBand = reportButtons.report.getComponentByName("DataBand1") as StiDataBand;
//clear sorts
banda.sort = [];
if (condition) {
    banda.sort.push(["ASC", "{dados.maskCodigo}"]);
    banda.sort.push(["ASC", "{dados.numeroPedido}"]);
    banda.sort.push(["ASC", "{dados.numeroEntrega}"]);
} else {
    banda.sort.push(["ASC", "{dados.maskCodigo}"]);
    banda.sort.push(["ASC", "{dados.lote}"]);
    banda.sort.push(["ASC", "{dados.loteOrdem}"]);
}
Thank you.

Dynamically Sorting

Posted: Tue Mar 15, 2011 6:51 am
by jorool
Hello

I found C# solution on "Support Center » Knowledgebase » How to change data sorting?".
It works fine.

Code: Select all

var banda:StiDataBand = reportButtons.report.getComponentByName("DataBand1") as StiDataBand;
banda.sort = new Array();
if (condition) {
    banda.sort.push("ASC");
    banda.sort.push("numeroPedido");
    banda.sort.push("ASC");
    banda.sort.push("numeroEntrega");
} else {
    banda.sort.push("ASC");
    banda.sort.push("lote");
    banda.sort.push("ASC");
    banda.sort.push("loteOrdem");
}
Thank you.

Dynamically Sorting

Posted: Tue Mar 15, 2011 7:04 am
by Vladimir
Hello,

You can simplify your code:

Code: Select all

var banda: StiDataBand = reportButtons.report.getComponentByName("DataBand1") as StiDataBand;
if (condition)
  banda.sort = [
    "ASC",
    "numeroPedido",
    "ASC",
    "numeroEntrega"
  ];
else 
  banda.sort = [
    "ASC",
    "lote",
    "ASC",
    "loteOrdem"
  ];
Let us know if you need any additional help.

Thank you.

Re: Dynamically Sorting

Posted: Tue Jul 31, 2012 9:48 pm
by jakrzysztow
Ok, so I find the band, set the sort...and nothing happens....so either I have the sort wrong and that's why nothing happens, or something else must be done to apply the sort?

Re: Dynamically Sorting

Posted: Wed Aug 01, 2012 5:56 am
by Vladimir
Hello,

Then you need to re-build a report, for example:

Code: Select all

...
report.isRendered = false;
report.render();
report.show();
Thank you.