320 likes | 334 Views
Wrapping Views around your fingers. Dennis Solis. Solis Media Group Over 20 years of application software development. 2 years of Drupal development Assisting with D8 Migration in core d.o . : densolis irc : # drupal-florida & # drupal -migrate: densolis skype: densolis.aol.com. 2.
E N D
Dennis Solis Solis Media Group Over 20 years of application software development. 2 years of Drupal development Assisting with D8 Migration in core d.o. : densolis irc: #drupal-florida & # drupal-migrate: densolis skype: densolis.aol.com 2
Views Aggregation TopicsModules Ask for filter views Aggregationviews views aggregator plus
Views If Time TopicsModules Views conditional views_conditional Download views_data_export
Ask for filter before view runs (Example 1) • Change from Basic to Input required.
You are all experts in Aggregation
What is aggregation? • Groups “things” in a useful way. • Aggregation means to collect, combine, and / or summarize data in some useful form. • In the context of views tables, aggregation is: • The process of grouping and compressing row • Based on the values of one or more columns • While applied summary (aggregation) functions on other columns. • Count, sum, minimum, maximum, etc.
How could you possible be a AGGREGATION expert?
Why? Organize your content in a meaningful way. Calculate summary totals
(Example 2) Aggregation
Other AggregationExamples Google analytics Nielsen TV ratings Gallup poll / surveys Summary reports totals Newspaper – News, Sports, Business
Two types of Aggregation Native aggregation from within Views Additional module: Views Aggregation Plus (views_aggregator)
Native Views Aggregation Aggregation is the process of grouping and compressing result rows based on the values of ONE OR MORE columns. Does NOT generate grand totals
Native Views Aggregation (Example 3) • Done from within the views module • Enable this by changing “Use aggregation: Yes” • Aggregate parameters assigned to each field • Examples • Restaurant menu • Sons of American Veterans
Native Views Aggregation Native aggregation from within Views
Native Views Aggregation CT – Customer Survey CT – Customer Order CT – Menu Item CT - Menu section CT – Wait staff Restaurant survey Example (4)
Views AggregationPlus Aggregation is the process of grouping and compressing result rows based on the values of only ONE columns, while applied summary (aggregation) functions on other columns. Does generate a grand total.
Views AggregationPlus • Download & enable the views_aggregator module (aka Views Aggregation Plus) • This add a new “format” in views • Table with aggregation options • Use table with aggregation Settings • Disables / over rides native Views aggregation • Examples • Restaurant menu Example (6) • Sons of American Veterans
Views AggregationPlus (Example 5)
Views conditionals module: views_conditional You want to check some condition before you decided to the field should be displayed. In my case, I check a person’s role before decide if they have the permissions to see a specific field. Example
Download a table into a CSV file modules: views_data_export The module view data export will allow you to download your table view into a comma separated value (CSV) file.
Download a table into a CSV file modules: views_data_export The module view data export will allow you to download your table view into a comma separated value (CSV) file.
Download a table into a CSV file (Example 6) Data export is exposed on your view
Download a table into a CSV file (Example 10) Choose “Data Export” from the +Add in views Notice your Format is CSV File
Download a table into a CSV file • You can put replacement patterns in the file name • Setting • The text “by deselection this, the xml file…” is a bit misleading. • Need to check “Provide as file” if you want a download file!
Download a table into a CSV file • Make sure you specify: • A path • I used <view_path>_dnld • Attach to – The view to attach the download. • Batch export – Yes if big download • Pager = Display all items
Views conditionals module: views_conditional You want to check some condition before you decided to the field should be displayed. In my case, I check a person’s role before decide if they have the permissions to see a specific field. Example
Make a table view “responsive” module: table trash While we cannot make a table view truly responsive, this does the next best thing. When the table view is displayed on a tablet or a phone, table trash hides the required number of columns so that the report will fit on the device. To expand the report the user can then click on the plus next to the line in which they are interested.
UHK Suggestions for Views • Name content types in singular • Names views in plural • Include node type in field name Example (1) • Easily find field in views list of fields. • If using multiple views: • “All displays” vs “this page” • Structure -> Views -> Settings • Show the SQL query • Make input required BEFORE views runs.
UHK Suggestions for Views • Page views with same path. • Bad – only one view will appear in the menu • Good – if the different views have different role permission, you can have multiple views under one menu item – and role appropriate view will appear. • With views aggregation – do not sort the data. Let the aggregation do it. • Don’t forget to put in No Results message in your view.
Congratulation! You are now an Advance Views builder!