Answers.Body: <p>I did read all the way down!</p>
  
  <p>Try Adding a Global PHP field under Sort Criteria-> you can then use PHP to say -> Gold=1, Silver=2 and Bronze=3; And indicate you want to sort Ascending.</p>
  
  <p>If you need a hand with the PHP - let me know.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-07T03:37:51.180Z
Answers.Text: Thanks, what you're saying make sense. I believe I need View PHP in order  to do this ... but Views PHP is not covered by drupal's security advisory. Am I worrying too much?
Answers.UserDisplayName: LaurynnLowe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-07T12:00:05.590Z
Answers.Text: It can't apply to be covered until it has an official rc - see: https://www.drupal.org/node/1011698 - so it does not necessarily mean it's not secure.
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-07T14:48:02.570Z
Answers.Text: I will try and post if it works.
Answers.UserDisplayName: LaurynnLowe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-09T16:41:48.947Z
Answers.Text: Hey - did you get it working - if you need help w/ php bit let me know
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-10T00:00:22.097Z
Answers.Text: no, the donor with the  "silver" contribution decided to donate even more money, so now they are in the "platinum" group and I can use a simple asc by total amount. --I'm a little disappointed; I was curious to try this solution out
Answers.UserDisplayName: LaurynnLowe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-10T03:56:53.477Z
Answers.Text: ha ha - next time :-)
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-06T23:32:29.713Z
Answers.LastActivityDate: 2017-04-06T23:32:29.713Z
Answers.UserDisplayName: KarinG - Semper IT
Answers.Body: <p>Not sure I fully understand what you are seeing, but are you meaning it is sorting as Bronze, Gold, Silver and Silver, Gold, Bronze?  ie alphabetically on the label rather than on the value?  If so, and if you don't care too much about the labels you could relabel them as '1 - Gold', '2 - Silver', '3 - Bronze' </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-09T12:52:01.523Z
Answers.Text: I did have a label with "1 Gold", "2 Silver" and it still didn't work. I don't understand why. I thought perhaps because it was a civiCRM custom field?
Answers.UserDisplayName: LaurynnLowe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-08T17:12:03.683Z
Answers.LastActivityDate: 2017-04-08T17:12:03.683Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>A simple work around would be to create three separate view blocks, one for each group, and then combine them in your favourite manner (e.g. context, block visibility, or the view field that pulls in other views, etc.)</p>
  
  <p>Here's an example: <a href="https://casrai.org/reconnect16" rel="nofollow noreferrer">https://casrai.org/reconnect16</a> (the sponsor blocks at the bottom of this page).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-13T02:12:01.433Z
Answers.Text: Yes! I absolutely considered this. Since there are 6 groups, hence 6 view blocks, I'm glad it didn't come to this.
Answers.UserDisplayName: LaurynnLowe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T18:16:55.020Z
Answers.LastActivityDate: 2017-04-11T18:16:55.020Z
Answers.UserDisplayName: Alan Dixon
Body: <p>I created a drupal view to display contributor names. The view displays civicrm fields, both custom fields I have created and out-of-the-box civicrm fields.</p>
  
  <p>The contributors are displayed according to the amount of their contribution. For instance, there are "Gold" contributors at the top, then "Silver", then "Bronze" etc.</p>
  
  <p>The categories that contributors should be displayed within is not related to the total amount of the contribution. So, for instance, I have a "Silver" contributor that gave more than a "Gold" contributor (for reasons related to an event). </p>
  
  <p>The problem is how to sort the fields so that the "Gold" group displays higher up than the "Silver" group. I cannot use Total Amount (desc) because of this silly Silver contribution that was more than the Gold contribution.</p>
  
  <p>I tried creating a custom field where these groups of contributions were simply assigned numbers, so Gold=1, Silver=2, Bronze=3, etc. When I use this criteria to sort, desc will put the Gold after Silver, so that it is highest in reverse order. But when I use asc, which <em>should</em> put Gold at the top, instead Gold is after Silver. </p>
  
  <p>This is driving me nuts. I realize it's pretty convoluted, so it's possible no one will actually read to the end. But there has to be a way to do this.</p>
  
Tags: <civicontribute><custom-fields><drupal-views>
Title: Sort Criteria for civiCRM custom in Drupal View
ThreadText: # Sort Criteria for civiCRM custom in Drupal View
  
  (Asked by: username_0 on 2017-04-06)
  
  I created a drupal view to display contributor names. The view displays civicrm fields, both custom fields I have created and out-of-the-box civicrm fields.
  
  The contributors are displayed according to the amount of their contribution. For instance, there are "Gold" contributors at the top, then "Silver", then "Bronze" etc.
  
  The categories that contributors should be displayed within is not related to the total amount of the contribution. So, for instance, I have a "Silver" contributor that gave more than a "Gold" contributor (for reasons related to an event).
  
  The problem is how to sort the fields so that the "Gold" group displays higher up than the "Silver" group. I cannot use Total Amount (desc) because of this silly Silver contribution that was more than the Gold contribution.
  
  I tried creating a custom field where these groups of contributions were simply assigned numbers, so Gold=1, Silver=2, Bronze=3, etc. When I use this criteria to sort, desc will put the Gold after Silver, so that it is highest in reverse order. But when I use asc, which *should* put Gold at the top, instead Gold is after Silver.
  
  This is driving me nuts. I realize it's pretty convoluted, so it's possible no one will actually read to the end. But there has to be a way to do this.
  
  **Tags:** civicontribute, custom-fields, drupal-views
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2017-04-06. Score: 2
  
  I did read all the way down!
  
  Try Adding a Global PHP field under Sort Criteria-> you can then use PHP to say -> Gold=1, Silver=2 and Bronze=3; And indicate you want to sort Ascending.
  
  If you need a hand with the PHP - let me know.
  
  > **Comments:**
  > **username_0**: Thanks, what you're saying make sense. I believe I need View PHP in order  to do this ... but Views PHP is not covered by drupal's security advisory. Am I worrying too much?  
  > **username_1**: It can't apply to be covered until it has an official rc - see: https://www.drupal.org/node/1011698 - so it does not necessarily mean it's not secure.  
  > **username_0**: I will try and post if it works.  
  > **username_1**: Hey - did you get it working - if you need help w/ php bit let me know  
  > **username_0**: no, the donor with the  "silver" contribution decided to donate even more money, so now they are in the "platinum" group and I can use a simple asc by total amount. --I'm a little disappointed; I was curious to try this solution out  
  > **username_1**: ha ha - next time :-)  
  
  ---
  
  ### Answer by username_2 on 2017-04-08. Score: 0
  
  Not sure I fully understand what you are seeing, but are you meaning it is sorting as Bronze, Gold, Silver and Silver, Gold, Bronze? ie alphabetically on the label rather than on the value? If so, and if you don't care too much about the labels you could relabel them as '1 - Gold', '2 - Silver', '3 - Bronze'
  
  > **Comments:**
  > **username_0**: I did have a label with "1 Gold", "2 Silver" and it still didn't work. I don't understand why. I thought perhaps because it was a civiCRM custom field?  
  
  ---
  
  ### Answer by username_3 on 2017-04-11. Score: 0
  
  A simple work around would be to create three separate view blocks, one for each group, and then combine them in your favourite manner (e.g. context, block visibility, or the view field that pulls in other views, etc.)
  
  Here's an example: <https://casrai.org/reconnect16> (the sponsor blocks at the bottom of this page).
  
  > **Comments:**
  > **username_0**: Yes! I absolutely considered this. Since there are 6 groups, hence 6 view blocks, I'm glad it didn't come to this.  
  
  ---
  
  