CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • 4.2 passing labels instead of values to views
Pages: [1]

Author Topic: 4.2 passing labels instead of values to views  (Read 864 times)

Tiffani Chin

  • I post occasionally
  • **
  • Posts: 101
  • Karma: 2
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.30
  • PHP version: 5.3.17
4.2 passing labels instead of values to views
February 04, 2013, 09:56:45 pm
Has anyone else had the experience of upgrading to 4.2 and then finding that custom fields are passing labels rather than values to Views (they were values before the upgrade)?

I'm not sure if this is an upgrade error or if this is me forgetting to set something properly.

I need to conditionally hide a lot of fields and I do it with 0s.

I would love any suggestions about:

1) how to pass values instead of labels

or

2) how to conditionally hide fields based on a label (it's a binary variable, so not complicated, but I'm struggling to find another solution).

Thanks in advance for any thoughts!
-tiffani

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: 4.2 passing labels instead of values to views
February 07, 2013, 08:02:00 am
Regarding your first issue, I don't know. :(

Regarding the second, I usually use jQuery to hide fields based on the custom field ID and value. I'm not sure exactly what you're asking however.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Tiffani Chin

  • I post occasionally
  • **
  • Posts: 101
  • Karma: 2
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.30
  • PHP version: 5.3.17
Re: 4.2 passing labels instead of values to views
February 07, 2013, 11:42:10 am
Thanks Hershel.

I am trying to create a page that shows students' names and the skills they need to work on.  If they get a skill right on a test, I don't want to show the name of the skill.  If they get a skill wrong, I want the name of the skill to show up.

I have the test results in a Civicrm custom fields, and I'm pulling the data into a View.

I have "correct" answers coded to 0 and "incorrect" answers coded to 2, so, before, I had the View hide empty fields and defined 0 as empty, so correct answers disappeared.

However, now, Views is reading "Correct" and "Incorrect" rather than 0 and 2.  So, nothing gets hidden.

I use the UI to create my views. Do you know if I can put jQuery code in the "rewrite" box?

I would have to figure out how to use jQuery, but knowing that I could use it there would be a good start.

Thanks!
-tiffani

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: 4.2 passing labels instead of values to views
February 07, 2013, 12:07:53 pm
OK, now I understand the situation.

Quote from: Tiffani Chin on February 07, 2013, 11:42:10 am
However, now, Views is reading "Correct" and "Incorrect" rather than 0 and 2.  So, nothing gets hidden.

In reality "Correct" and "Incorrect" are better to show than 0 and 2, so this change is for the better I think. Overall. :)

Regarding your issue, you have a few options. One is to use a custom template for your fields and a bit of PHP code to hide "Correct" fields. Another is that it might be possible to put this code in the rewrite box--offhand I don't recall if such a feature exists.

The other possibility is indeed jQuery--you can use jQuery to determine if a value is "Correct" and then hide that field.

What is the easiest method? Depends on the details of the page really. And your skills in JS and PHP. :)
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Tiffani Chin

  • I post occasionally
  • **
  • Posts: 101
  • Karma: 2
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.30
  • PHP version: 5.3.17
Re: 4.2 passing labels instead of values to views
February 08, 2013, 09:50:51 am
Hi Hershel,

Yes, Lobo confirmed that the functionality that I was using (based on values rather than labels) was actually a bug that's been fixed in 4.2.  So, I was making use of a problem.  :)

It's funny -- I have a background in statistical analysis -- and of course in that case, values are critical and labels are helpful but never used for analysis, so I was just applying the wrong logic to the "bug v function" issue.

Thank you for pointing me in the right direction(s)!  As ever, I need to improve all of my coding skills.
-tiffani

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • 4.2 passing labels instead of values to views

This forum was archived on 2017-11-26.