The Auto Columns element provides an easy method of viewing all datalayer columns without having to know their names and without loading up a definition with Data Table Column elements. This topic discusses the use of the Auto Columns element.
The example above shows a report definition containing a table with one column and the report output.
However, when an Auto Columns element is used instead of (or with) Data Table Column elements, as shown above, the resulting report output will contain all of the columns. The column header text of these "automatic" columns will match the names of the columns in the datalayer. And if you combine Auto Columns with Data Table Column elements, the automatic columns will always appear to the right of any specified using Data Table Column elements.
The Auto Columns element has no attributes and there are no data formatting options.
How Is This Useful?
Where can this element be used to good effect? Though we don't discount the resourcefulness of developers in making use of this element in production, it's designed for use in development or diagnosticsituations, such as:
- Including an Auto Columns element and remarking/unremarking it during development can provide a quick way to ensure that the datalayer is actually receiving the expected data.
- The Auto Columns functionality is useful in situations where the count and names of columns returned to a datalayer vary dynamically based on a query or situation. For example, imagine that a web service your application uses suddenly changes the results that it returns; use of Auto Columns can help you discover the change.
- Consider this query: SELECT * FROM @Request.TableName~. In this case, you may not be able to hard-code the columns in the result as elements in a report definition because the table name varies and so, possibly, will the column names.
Should you attempt to use Auto Columns in a production situation, note that this element is processed at a different time by the Logi engine than other elements, which can result in no data being shown. For example, if you try to use Auto Columns as a child of More Info Row, no data will be displayed when the More Info Row is expanded.