New call-to-action
Results 1 to 5 of 5

Thread: Color Code Based on Odd / Even number

  1. #1
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default Color Code Based on Odd / Even number

    Is it possible (hard to believe it's not) to color code a field based on the year being an odd or even number?

    It's important for the year to stand out in a browse so that the user can more easily differentiate 2012 for 2013, etc., thereby more easily visual identification for the record.

    A field containing just the year can be a Numeric, character or date format. In my case, I have it set as a character but only because it's not based on a date field because there is no date field in the table and unless a date field is needed to facilitate this, in which case I could use a calculated field to simply show the current date and format it do show only the year. Doing that, How can I show the odd years to be of one color and the even years to be of another?

    Thanks for the suggestions.
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Color Code Based on Odd / Even number

    an odd number
    mod(number,2) = 1
    an even number
    mod(number,2) = 0

  3. #3
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default Re: Color Code Based on Odd / Even number

    Quote Originally Posted by Stan Mathews View Post
    an odd number
    mod(number,2) = 1
    an even number
    mod(number,2) = 0
    Thanks Stan but I need a bit more. How is the col;or identified with this?
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Color Code Based on Odd / Even number

    You are familiar with font equations for fields on forms and columns in browses.

  5. #5
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default Re: Color Code Based on Odd / Even number

    Well Stan, I looked at you response and that was where I thought it would go but I couldn't see how that would work. Ah, take a look at the Mod function, I thought. After a looksee, That didn't make sense to me either except for two things: 1) Maybe the word 'number' is a reference to a numeric field and 2) Stan says it will work so, give it a try. I changed the Year field to a numeric format and then went to the Other tab of the field Properties, set the colors and the expression: mod(T_Worksite->Year,2)=1. Saved everything, opened the browse and entered an odd number year. What do ya know? It worked. Entered an even number year in the next row and, walla.

    Thank you Stan! Once again you've come through with flying colors.

    Clarification: While I could have said, "Thanks Stan, that works great!", it might not help newbies. That's not to say Stan was amiss in not providing more details. Not at all. His goal was to point me in the right direction and let me figure it out for myself. I went into detail only because there might be a newbie or two that would have a difficult time with it. So, to Stan I say, "Thanks for your approach!"
    Last edited by forskare; 01-13-2013 at 09:13 AM. Reason: Clarification
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

Similar Threads

  1. Odd Internal Error Concerning Alpha's Source Code
    By Steve Andrews in forum Alpha Five Version 10 - Desktop Applications
    Replies: 6
    Last Post: 02-09-2012, 02:41 PM
  2. Button Color Change Based on Data
    By jbk in forum Alpha Five Version 9 - Desktop Applications
    Replies: 20
    Last Post: 11-07-2011, 08:00 AM
  3. Button color change based on data
    By jbk in forum Alpha Five Version 10 - Desktop Applications
    Replies: 22
    Last Post: 10-27-2011, 10:07 AM
  4. Color Equation based on mode
    By smrogers in forum Alpha Five Version 7
    Replies: 6
    Last Post: 04-21-2006, 08:36 PM
  5. Test for odd-even number
    By Albert Conner in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-24-2005, 03:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •