1

I cannot seem to figure out how to format a number within a textbox that is being summed within an iif. Here is how my code looks:

=iif(
  SUM(
   iif(expression, number1+number2+number3, number4+number5+number6)
      )
    )>=10000000,true, false)        

In the part that says true I would like to format the number being summed, but it is being used in the comparator as well. Normally I would just assign the sum to a variable and continue with the conditional check, but I am not sure how to proceed. Is there a way to assign variables within a textbox expression, or am I coming at this the wrong way?

DDushaj
  • 127
  • 8
  • is that mandatory to use those embeded if? to me it could be the case to have a variable that will handle the sum of the values and then return s string.format depending on the conditions, does that make sense? – pedrommuller Mar 18 '14 at 13:33
  • @Pedro - Yes it is mandatory, but if I could assign the sum to a variable I can do exactly what you said. I just don't know if I even can – DDushaj Mar 18 '14 at 13:59

1 Answers1

2

Try this example, using a TextBox called YourTextBox:

//set value
YourTextBox.Value = Sum(IIf(expression, num1 + num2 + num3, num4 + num5 + num6))

//format value
YourTextBox.Format = IIf(ReportItems!YourTextBox.Value >= 10000000, "c2", "f2")

//format style
YourTextBox.BackgroundColor = IIf(ReportItems!YourTextBox.Value >= 10000000, "Red", "Lime")
tezzo
  • 10,858
  • 1
  • 25
  • 48
  • Excellent, works just as intended. The ReportItems!YourTextBox.Value is what I was looking for thank you! – DDushaj Mar 21 '14 at 14:24