Drupal 7: Search fields - drupal

I've just started to learn Drupal and decided to implement a simple "Student list" site.
In my content type "Student" I have added a numerical field "age". And now, after entering some content and reindexing I want to perform search on the "age" field.
If I enter some valid age into search box, then nothing is found.
How do I find students by age or by age range?

If you're new to Drupal, each of these steps will require its own instruction. Luckily, there are plenty of tutorials on the interweb.
To create a sortable/filterable list page from your student content type:
Create a view from the student content type.
Set the new view's display type to Table View and ensure that the the age colum is listed as a field you want to display.
Set the table's headers to clickable (so that you can sort your list when it's displayed.)
Use exposed filters to allow people to filter your group by an age, age range, or other criteria (e.g. last name, etc.).
I'd consider the following searches for each step:
Drupal 7 Create View site:youtube.com
Drupal 7 Table View Display Format
Clickable Table View Headers in Drupal 7
Drupal 7 Exposed Filter site:youtube.com

Related

Showing count of content based on the select list values Drupal 7

I have a requirement in which I need to show some content along with its count based on values in a select list. I wanted to display the allocated,released and resigned resources of a particular department in a selected date range. Using views, date range and department fields are created as exposed filters.
Created a content type for creating resources. The Resources content type is having action as a select list with values allocated,released,resigned. Department is another select list and date field is also added.
Please help me with an answer if views module is not enough. Provide some other solutions also. I'm using Drupal 7.
I figured out how to show node count in views. In my view I’ve some exposed filters and passed my select list cck field as contextual filter. If no result available I made the view to display summary as row count. In the template file, I’m planning to do some calculations for showing the resources count in and out of the project. Please correct me if there is anything wrong in this approach.

Make Drupal 7 Group by always show grouping field

I have a Drupal 7 view similar to the one described here: Drupal 7 Views - list group by field
I wish to have all the groupby fields always appear even if there are not members of them and ideally I wish to put a default value in such a list.
eg:
Foo:
-Jay
-George
Bar:
-Barry
Boo:
Sorry no entries at this time!
Suggestions?
If none of what you are fetching with the view is associated with the group 'Boo' then the view doesnt know it exists, so would never be able to show it but say there is no results for it.
What i would recommend is creating a taxonomy vocabulary with the terms: Foo, Bar, Boo.
In whatever content type your names belong to, create a term reference field, and link them to the terms.
In the view, fetch the taxonomy terms, create a relationship to the content type that references the taxonomy, and pull those through based on that. There is a setting in views for multiple results to combine into one field (so you would want to do that). Then you could add the 'Sorry no entries at this time!' as a field's no results text.
So to recap: VIEW => TAXONOMY TERMS => NAME CONTENT

how to limit view to just show each type one time?

I have a content type what is news, the news has a field type that is List (text) to keep different types of news. for example I have Health, Sport, Economic and etc.
So now I am going to create a block and have each of these type in that as a hyperlink.
I can do it and I created a new view block but each news_type may showing more than one time according to published content.
How to set the view (for block) to just show news_types and show them just one time?
You can achieve this by following the steps given below:
Enable aggregation under Advanced Accordion of the view
Add Nid field & set aggregation type as Count Distinct
Exclude Nid field from display
Add news type field & set Aggregation type as Group results together, in Group Column select Value option from dropdown
Remove Publishing Date from sort criteria
Please check attached screenshot for reference
You can check this question for more information, and maybe help you.

Drupal Profile2 / Field collection sorting records

As continuation of this article Drupal nested / complex / sub content types I have a new question.
As described, using Profile2 and Field collection I've managed to create multi-user CV management system:
Created a content type called CV.
Added a field_collection field to CV called education and allow unlimited entries.
Edited the education field_collection item and add a date field and a text field.
Did the same for work experience and any other fields.
Unfortunately, users should be able to reorder the records (date-text), e.g. to put some of the entries before others. For the moment being they appear in the order of their input.
How to achieve that?
Thank you!
The image below shows a field collection I have made with 3 fields.
One the left of each collection item is a drag handle.
You can re-order content using these handles.

Generate fields in content from other content values?

I want to generate fields in a content from the values of other content.
Specifically, I have a list of "players" stored as a content type, and a separate content type called "Events". Events list the rank of each player that participated. On the "player" content, I'd like to be able to display the players wins by searching all the "events" content. Is this possible?
Also, in Views, is it possible to generate a list of all the events a player has won, as well as how many?
1) Yes it is possible with views "Advanced > Contextual Filters". Before that you have to Create a Relationship ("Advanced > Relationships") with the field of the event that contains the Player information.
2) In this case you have to set the "Advanced > Use aggregation:Yes" and then use the "Count (Distinct)" aggregation in any field in the results.
If your Drupal level is not too high with views module better start with some learning tutorials like these from here: https://drupal.stackexchange.com/questions/5684/where-can-i-find-a-good-tutorial-on-drupal-7-views

Resources