wrapping view around your finger 2
TRANSCRIPT
2
Dennis SolisDennis Solis
Solis Media GroupSolis Media Group Over 20 years of application software development.Over 20 years of application software development. 2 years of Drupal development2 years of Drupal development Assisting with D8 Migration in coreAssisting with D8 Migration in core d.o. : densolisd.o. : densolis irc: #drupal-florida & # drupal-migrate: densolisirc: #drupal-florida & # drupal-migrate: densolis skype: densolis.aol.comskype: densolis.aol.com
Dennis Solis
Born and raised in SFBorn and raised in SF
3
Live in Cocoa, FloridaLive in Cocoa, Florida
UHK Suggestions for ViewsUHK Suggestions for Views Name content types in singularName content types in singular Names views in pluralNames views in plural Include node type in field name Example (1)Include node type in field name Example (1)
Easily find field in views list of fields.Easily find field in views list of fields.
If using multiple views:If using multiple views: ““All displays” vs “this page”All displays” vs “this page”
Structure -> Views -> SettingsStructure -> Views -> Settings Show the SQL queryShow the SQL query
Make input required BEFORE views runs.Make input required BEFORE views runs.4
UHK Suggestions for ViewsUHK Suggestions for Views Page views with same path.Page views with same path.
Bad – only one view will appear in the menuBad – only one view will appear in the menu Good – if the different views have different role Good – if the different views have different role
permission, you can have multiple views under one permission, you can have multiple views under one menu item – and role appropriate view will appear.menu item – and role appropriate view will appear.
With views aggregation – do not sort the data. With views aggregation – do not sort the data. Let the aggregation do it.Let the aggregation do it.
Don’t forget to put in No Results message in Don’t forget to put in No Results message in your view.your view.
5
ViewsViews
TopicsTopics Modules
Contextual Filter views, ctools
Views Relationship views, ctools
Aggregation views, views aggregator
6
Views Views If TimeIf Time
TopicsTopics Modules
Views conditional views_conditional
Download views_data_export
Relationship entity reference, entity
entity connect
7
What is a contextual filter?
Basically a contextual filter is simply a way of limiting what information you displayed to the user.
9
Contextual Filter Contextual Filter ExamplesExamples
Courses on a restaurant’s menu Bad Camp sessions Airline reservations Filter by product types on Amazon or E-Bay
16
Contextual FiltersContextual FiltersSamplesSamples
Restaurant MenuRestaurant Menu Example (2)Example (2) Sons of American VeteransSons of American Veterans
17
What is a relationships?What is a relationships?
18
Content
Menu category•Starters•Appetizers
Author’s NameUser
ImageContent type (taxonomy)
Why?
You want to maintain a single copy / instance of your data.
Your web site reference the single copy / instance of your data.
If you change the data, it is changed through out the web site.
19
RelationshipsRelationships
21
Because of the relationship, you know some things about the other person.
RelationshipsRelationships
22
Content
Menu category•Starters•Appetizers
Author’s NameUser
ImageContent type (taxonomy)
RelationshipsRelationships
Author / user create a content node An image is associated with a content node A taxonomy term associated with a content node Another entity associated with a content node
23
Relationship / SQL ViewRelationship / SQL View
INNER JOIN: Returns all rows when there
is at least one match in BOTH tables.
LEFT JOIN: Return all rows from the left
table, and the matched rows from the right table.
24
RelationshipsRelationships
25
CT – Menu Item
CT – Wait staff
CT – Customer Order
CT – Customer Survey
CT - Menu section
Relationship ExamplesRelationship Examples
Display an customer order Example (3)Example (3) Restaurant customer order relationships:
Waiter / staff Item order reference menu dish
27
ViewsViewsAdd relationshipsAdd relationships
Views – Add relationship Example (3) Referenced – Read entity referenced from
source View is based upon Customer Order and reading
Staff, and Dish information
Referencing – Read source from entity reference View is based upon Staff and reading Customer
Order information.28
What is 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.
29
Other AggregationOther AggregationExamplesExamples
Google analytics Nielsen TV ratings Gallup poll / surveys Summary reports totals Newspaper – News, Sports, Business
33
Two types of Two types of AggregationAggregation
Native aggregation from within ViewsNative aggregation from within Views
Additional module: Views Aggregation Plus Additional module: Views Aggregation Plus (views_aggregator)(views_aggregator)
34
Native Views Native Views AggregationAggregation
Aggregation is the process of grouping and compressing result rows based on the values of ONE OR MORE columns.
Does NOT generate grand totals
35
Native Views Native Views AggregationAggregation
Done from within the views moduleDone from within the views module Enable this by changing “Use aggregation: Yes”Enable this by changing “Use aggregation: Yes” Aggregate parameters assigned to each fieldAggregate parameters assigned to each field
Examples Restaurant menuRestaurant menu Example (4) Example (4) Sons of American VeteransSons of American Veterans
36
RelationshipsRelationships
37
CT – Menu Item
CT – Wait staff
CT – Customer Order
CT – Customer Survey
CT - Menu section
Native Views Native Views AggregationAggregation
Restaurant survey Restaurant survey Example (5) Example (5)
38
CT – Menu Item
CT – Wait staff
CT – Customer Order
CT – Customer Survey
CT - Menu section
Views AggregationViews AggregationPlusPlus
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.
39
Views AggregationViews AggregationPlusPlus
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 ExamplesExamples
Restaurant menuRestaurant menu Example (6) Example (6) Sons of American VeteransSons of American Veterans
40
Congratulation!Congratulation!
You are now an Advance Views builder!You are now an Advance Views builder!
41
Views conditionals
module: views_conditional module: views_conditional Example (7)Example (7)
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..
ExampleExample
42
Download a table into a CSV file
modules:modules: views_data_exportviews_data_export
The module view data export will allow you to download your table view into a comma separated value (CSV) file.
43
Make a table view “responsive”
module: table trashmodule: 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.
44