0

I'm using Drupal 8.

I want to count the number of results of a text field if they are similar.

I added a simple text field to my "Article" content type.

Users can enter the text (short) they want: textA, textB, textC ... I do not know this text and can not make a selection list.

I wish I could count the number of times a user entered textA, textB etc.

I tried with Views and Aggragation function, but it does not work. Indeed it works only for the results corresponding to selection lists where a reference to a term etc.

Any idea ?

  • Consider 'Select or other' module which allows users to either select or add a new value. – Jonathan Feb 6 '18 at 0:47
0

I'd use taxonomy terms and the tagging feature built into drupal. There's an example of it on the Article content type that comes with drupal's standard install

So a user can start typing a term and the autocomplete will appear if that term already exists. The user can select it if it exists already. Otherwise when the node is saved the term will be created. You can select multiple terms by comma separating them exactly as you mentioned

Then getting a count of terms will be much more straight forward and should be do-able in views as each time a term is associated to a field it's stored in the database

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.