3

I collect data in case activities, and I'm currently trying to build a Drupal Views of this data. I'm running into a problem with multiple fields. For example: "What colors do you prefer?" The results are showing up like:

Red, Blue, Green Green, Blue

Is there a way to present each line as a color? My end goal is to create a pivot table to show a count of each color. I have a lot of multiple field questions that have this problem right now. The only solution I can think of is to create a PHP code to output a if statement == "RED" line by line.

2

Check out Charts, Google Charts module - if not for this purpose you'll be using it for some other data displays soon!

Below is a screenshot of a View - Page of Format: Chart -> aggregating by Grant Type over a certain time period [PS - the Table is an attachment -> Format: table]. For your use case try Aggregate by your custom field containing the Colors.

enter image description here

  • This would have been really awesome, but Views is treating Civicrm multi-fields as one field. Therefore, "Red, Green" can't be split up. – Kristine Aug 12 '18 at 22:22
1

I would suggest indeed that you use a php field in your views and a field per option and filter the options out.

The multi value custom fields store their value with a special character as a separator.

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.