Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:51:35+00:00 2026-06-06T05:51:35+00:00

SO Post Current I’ve got 5 bars in my RS chart – in the

  • 0

SO Post

Current I’ve got 5 bars in my RS chart – in the future there might be 7 bars or 17 bars or 27 bars!

With a couple of bars I can have an expression like this:

=iif(Fields!Market.Value = "Spain"
,"Gold"
,iif (Fields!Market.Value = "Denmark"
    , "Gray"
    , iif(Fields!Market.Value = "Italy"
        , "Blue"
        , "Purple"
        )
    )
)

If I can’t predict how many countries will be included + I’d rather not have to hard code in “Green”, “Red” etc how do I change the expression?

I’ve tried this but it is erroring:

=Switch(Mod(Fields!Rank.Value/CDbl(2))=CDbl(0), "Gold", 
   Mod(Fields!Rank.Value/CDbl(3))=CDbl(0), "Gray", 
   Mod(Fields!Rank.Value/CDbl(2))>CDbl(0) "Blue")

Above is the totally incorrect syntax: This works:

=Switch(CDbl(Fields!Rank.Value Mod 2)=CDbl(0), "Gold", 
   CDbl(Fields!Rank.Value Mod 3)=CDbl(0), "Gray", 
   CDbl(Fields!Rank.Value Mod 2)>CDbl(0), "Blue")

Ok – the above runs (not sure how!) but the below is based on help from Dominic Goulet and is really easy to follow and nice and expandable to more colours; this is the solution for 5 colours:

=Switch(CDbl(Fields!Rank.Value Mod 5)=CDbl(0), "Gold", 
   CDbl(Fields!Rank.Value Mod 5)=CDbl(1), "Gray", 
   CDbl(Fields!Rank.Value Mod 5)=CDbl(2), "Green", 
   CDbl(Fields!Rank.Value Mod 5)=CDbl(3), "Red", 
   CDbl(Fields!Rank.Value Mod 5)=CDbl(4), "Pink")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:51:38+00:00Added an answer on June 6, 2026 at 5:51 am

    First of all, instead of using many “IIF”s, you should use “Switch”, it’s leaner that way.

    Switch(Fields!Market.Value = "Spain", "Gold",
           Fields!Market.Value = "Denmark", "Gray",
           Fields!Market.Value = "Italy", "Blue")
    

    Now if you want a color per coutry, you should defenitely store that in your database and pull it out when you need it. That way, a country will always have the same color on every report you have.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This post identifies a feature that I would like to disable. Current numpy behavior:
I'm trying to measure the popularity of a post but there's no current system
I would like to have the currently displayed Page or Recent post highlighted with
Anyone know how I can get the post ID of the current page? So,
I have a loop like such: <% @posts.each do |post| %> <% render middle
I need to check is the current post in users favorites list something like(in
I have a website on which I want to post the current xkcd comic.
I'm trying to create an auto generated post excerpt from the current page's post
Post-release, I have made one small change to one form in our development site
This post on SO answers most of the questions I have (much thanks to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.