record list to excel - control column order

record list to excel - control column order

  
I am making a local list of records on my page.  I am putting several items into the list of records.  I want to control the order of the columns when I do a record list to excel and then download in an action on that page.  Is there a way to control the order of the columns when doing it this way?
well, you should use advanced_excel...
it's not really straightforward ofcourse :)

there are a couple of approaches ofcourse.
- how dynamic is the order of columns, are we talking about 10 columns, 100?
 if there are not many, you may use a a couple of pre-defined structures to fill it accordingly, and export that.
based on the order the user has chosen...

- do you have a 3rd party component?
advanced excel etc. has more features.

the other problem is ofcouyrse, client side ordering...
well, you could use the predefined structures...
(and multiple webblocks or so)

or you can look for jquery components...


that said, why do you want to order the columns?
business-value is very low, because it's dead easy in excel anyways!
swapping columns in excel takes roughly 2 seconds effort.
swapping columns in html takes a couple of hours developing, testing, fixing etc.


J, the only real reason in this case was to match the order of columns in an existing report.  From the above I think the easiest is to just have the end user rearrange them if they want.  Thanks for the info.
well, if it's just 1 order of columns, just use a structure for that?

that would be easy then...

1 structure = 1 application unit.  1 local record/list = 0 application units.
sort your entity in the right order then?
you can move them about?


but if you have concerns on AO's already, well, then let the user move it in excel..

not sure I understand - as far as sorting the rows I can do that (say by first start date ascending) but what I want to do is when I send that list to excel change the column order.  Which I can not.

Hey Jason

Did you ever get usable reply to your question? In the absence of a usable report writer, you'd think the Excel export mechanism wouldn't be so haphazard ...


Cheers


Jason Herrington wrote:

not sure I understand - as far as sorting the rows I can do that (say by first start date ascending) but what I want to do is when I send that list to excel change the column order.  Which I can not.




Leo,

The best fix I found was to make a local variable list of record and then set the order of the columns by the order of items in the list of record.  Then the name you put for each item in the list shows up as the excel column name.  Yes, you would think someone would make a much more controllable Excel export function especially for making excel exports specific to the needs/desires of the end user requesting the report but I haven't seen it yet.

Jason Herrington wrote:

Leo,

The best fix I found was to make a local variable list of record and then set the order of the columns by the order of items in the list of record.  Then the name you put for each item in the list shows up as the excel column name.  Yes, you would think someone would make a much more controllable Excel export function especially for making excel exports specific to the needs/desires of the end user requesting the report but I haven't seen it yet.


I would be curious how you would such a feature to actually *work* and be *usable* to a developer at the same time, given the manner in which Actions are called. Would you pass in a record list of column names in the order they should appear in, for example? How would this function as a "drop this into your logic" level?

J.Ja

Hey Jason

It's a lot of work for what is essentially a simple and, to my mind, obvious requirement.

The way it would work is, the list offered to the developer isn't just a checkbox saying "export this one", but a drag-and-drop selection mechanism that says, "export these ones, in this order". Creating an Excel structure that reflect the correct export order and then laboriously transferring the contents of one record list (column by column, row by row) into another is hardly in the spirit of Rapid Application Development .. :-)

Leo


Leo - I agree.  Actually taking it one step further would be the developer supplies the list (either from an aggregate or a custom record list) to a standard table widget (with the option on the developer side to say if a certain field is viewable or not in the list) and then when the viewer sees the table they automatically have pagination, excel export etc without us having to put all that extra code in each time we drop a table.  Then for the excel export have a button for "export as is" or a "customize my download".  If the end viewer hits the customize my download they are presented with a popup with all the fields and can select which fields they want to download and click and drag to change the order of the fields.  Heck, throw in the ability to make their own calculated fields as well for fun. :)

Dream on, big man. :-)


Jason Herrington wrote:

Leo - I agree.  Actually taking it one step further would be the developer supplies the list (either from an aggregate or a custom record list) to a standard table widget (with the option on the developer side to say if a certain field is viewable or not in the list) and then when the viewer sees the table they automatically have pagination, excel export etc without us having to put all that extra code in each time we drop a table.  Then for the excel export have a button for "export as is" or a "customize my download".  If the end viewer hits the customize my download they are presented with a popup with all the fields and can select which fields they want to download and click and drag to change the order of the fields.  Heck, throw in the ability to make their own calculated fields as well for fun. :)