If you're looking to build a CSV export for your module's data or you need a view that's based on more complex search patterns, module reports are what you're looking for. Report types fall into two categories: CSV Exports and Filtered Views. CSV Exports allow you to run a set of queries and have a downloadable CSV exported. Filtered Views allow you to run a set of queries which present you with an existing view with search results filtered.
- Title — Relates to the module action's title (i.e. Export News)
- Data Table — The MySQL table we're going to be searching.
- Type — Either CSV Export for downloadable results of Filtered View for editable results.
- Data Parser Function — This property only shows up for the CSV Export type. This should be just a function or method name (i.e. "myFunction" or "MyClass::myFunction"). Your function will receive an array of data to filter, modify, and return.
- Filtered View — This property only shows up for the Filtered View type. This is the View you wish to use to show the report results. It should use the same table as the Data Table.
Filters allow you to setup fields for a user to filter your module's entries by. Each column of the Data Table can have a filter applied to it, even reserved columns. Filters come in several types:
- Simple Search — A search field is entered. Rows from table that match the search query entered for the given column are matched.
- Dropdown Select — Each distinct value of the column is presented in a list. If selected only rows with a given column value are matched.
- Yes/No/Both Select — A list is presented with the user to choose Yes/No/Both. This is generally used for reserved columns (approved, archived, featured) for determining whether there is a value in the column or not.
- Date Range — Two date pickers are presented. If the column has a date/time that falls in the range the row is matched. Only viable on DATE/DATETIME/TIMESTAMP columns.
In a report the user can choose to sort by the fields in a view or the CSV export. The field to sort by can be chosen as well as Ascending or Descending direction.