0

I'm new to Drupal. Can anyone advice me on what's the method of collecting data information from inserted results?

For example, suppose I have book content type, when I insert data into its fields I want a page to show results of the following:

  1. How many book has been inserted? (eg. 5 books)
  2. How many magazine? (eg. 2 magazine)
  3. How many references?(eg. 1 reference)
  4. How many novels? (eg. 2 novels)
  5. How many guide book? (eg. 0 guide)

I've been trying to figure this out through and my last option which is to code the result myself(the hard way).

  • First you describe how to define magazine, references, novels, guide book in your book content type – Nishant Jun 12 '15 at 4:46
  • it would be a field which will give an option of choosing the type of book the user is inserting. – Abdulaziz Hamdan Jun 12 '15 at 6:52
1

Such page can be creating using various approaches, as further explained below.

Using Views and Views Calc

Use the Views module, together with the Views_Calc module. Here is a quote about Views_Calc (from its project page):

... adds simple calculations to a views table. Requires the Views module.

You can SUM, AVERAGE, COUNT, MIN, MAX, or AVG selected columns. A plug in theme makes the view look more spreadsheet-like (right justifies numeric fields, shades calculated columns and rows, and underlines calculated rows).

You can also create custom dynamic fields that can be used in any view using SQL snippets like CONCAT('field_first_name', ' ', 'field_last_name') or DATE_FORMAT(node.created, '%m/%%d/%Y'). The custom fields are set up in admin/settings/views_calc.

Refer to the question about How can I show average votes of fivestar nodes? for some screenprints about how to use this module.

Using Forena

If you'd want to "roll your own cookies" (i.e. some report that perfectly fits your custom requirements), then you might want to consider the Forena module. Here is an excerpt about that from its Community documentation:

Forena Reports is built of the idea of using SQL to get data out of a database and use XHTML and CSS to format it into web reports.

It is designed to leverage existing knowledge of HTML, CSS, SQL and JavaScript to help you create rich interactive web reports.

For an example of such custom report, created with Forena, start from the statistics (summary info) of the Watchdog Statistics, as in this Watchdog Statistics sample. Note the red numbers to the right of the table, which are actually hyperlinks that can be used as drill-down reports. I.e. if you click on any of them (like the "2" for "Page not found"), you get a details report about (in this case) the 2 specific records related to the "Page not found"). More details about this specific case can be found in comment #2 of issue 2337327. Obvious, I didn't really do any effort to beef up the look-and-feel of that report, like background, etc.

Disclosure: I'm a co-maintainer of Views_Calc and Forena,
I hope this does not violate the site's policy on self-promotion.

  • oh man, i've been spending a whole week on the net trying to figure out this through modules and stuff before my last option which was coding the result (the hard way)..i never came across this module from my research.. forena seems bit complex than views_calc from your explanation, i think this would do the job....and YES this is exactly what i was looking for! God bless u man! Thanks :D – Abdulaziz Hamdan Jun 12 '15 at 6:41
  • oh my apology, i am new to this website and i was trying to upvote (which didnt work)but didnt notice the "accept answer", no questions so far. Thank you for the notes. – Abdulaziz Hamdan Jun 14 '15 at 8:44
  • No need for apology, this website takes a little time to get used to all its features, rules, etc. If you have other questions: keep asking them (by creating new questions). The more you ask, the more ways there will be to receive "points" for asking, accepting answers, etc. And you only need 15 for being allowed to "upvote". Keep in mind: I did not invent those rules, I also find a few of them rather strange, but that's how things work around here ... – Pierre.Vriens Jun 14 '15 at 9:11
  • yeah, i can see that. im starting to get used to it. Question, would these modules be used to labeled fieled? i mean, in my question, i wanted the result to be displaying the book types(which will be taken from taxonomy terms) like novel, magazine. thanks – Abdulaziz Hamdan Jun 15 '15 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.