Tip: Exporting structures with more than 127 attributes to Excel

Tip: Exporting structures with more than 127 attributes to Excel



When using the RecordListToExcel to export a structure with more than 127 attributes will generate the error message Too many fields defined..

A Typical error stack is like:

Message :[1] Too many fields defined.
Stack: at ssSLSRetail.Flows.FlowFrontOffice.ScrnProductLabels_Export.CommandWord(HeContext heContext)
at ssSLSRetail.Flows.FlowFrontOffice.ScrnProductLabels_Export.wt_Submitwidget142184_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()


Parafrasing the Microsoft Article 199076:

"The Microsoft Jet database engine has an internal limit of 255 fields per query. As the Microsoft Jet database engine iterates through the records in an update query, it creates a field for the original value and a field for the updated value. When more than 127 fields are selected, it reaches the 255 field limit of a query."

This means that structures with more than 127 attributes will hit this 255 field limit in the Microsoft Jet database Engine and generate this error message.


There's no directly solution for this problem, because it's a limitation of the MIcrosoft Jet database Engine, which is used by OutSystems platform for exporting/importing data to/from excel.
However, it's possible to workaround this problem using at least two types of approaches:

1. Build a HTML webscreen table for your data and then convert to Excel, as throughly explained in the forum Topic Sample: Producing fully styled Excel reports
2. Generate a Comma Separated Values (CSV) file through text data types and a text output file

Best Regards

Miguel Simões João

Hi all....Do you know if there is a fix for this problem already?

Best Regards,

Diogo C S Cordeiro