Error With Switch Syntax
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
I am stumped on why I am getting the result of my switch statement. I am getting an error output on 2 of the 7 outputs. I am trying to increment up a discount level when my qualifying condition is met.
If [Furthers] = "Yes" Then
Switch([CLR],0,0.2,0.3,0.25,0.4,0.3,0.4,0.4,0.5,0.5,0.6,0.6,0.75,0.75,0.75)
Else [CLR]
EndIf
Furthers is a string and only has the values of "Yes" or "No". CLR is a double type that only has the values .2, .25, .3, .4, .5, .6 & .75. I am outputting into a new field called New % that is also a double.
The ones that are giving me the default output (0) are when the original value = .3 and .6 and Furthers = "Yes". All other combinations work fine.
I've tried reversing the order (largest to smallest) and made it all nested ifs and keep getting the same result. I've done summarizes on the CLR and there are no other values or numbers further out.
Any suggestions on what I am doing wrong?
Solved! Go to Solution.
- Labels:
- Expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I don't think that you're doing anything wrong.
If [Furthers] = "Yes" Then
Switch(ToString([CLR]),0,
"0.2",0.3,
"0.25",0.4,
"0.3",0.4,
"0.4",0.5,
"0.5",0.6,
"0.6",0.75,
"0.75",0.75)
Else [CLR]
EndIf
There seems to be a "rounding" issue with how the switch data is evaluated. I convert the data to string and it works fine. You should place this into ideas and identify it as a 'bug'.
Cheers,
Mark
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you! I will remember that trick for the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi MarqueeCrew
What can be wrong with that? I would like to populate empty cells basing on below combined formula, it is populating empty cell by appropriate comment basing on LOCAL ID column ("double" format). Output column is COMMENTS:
IF (IsEmpty([Comments])) THEN
(Switch([LOCAL ID],'not signed yet'
,[LOCAL ID]=a,'X not signed yet'
,[LOCAL ID]=b,'Y not signed yet'
,[LOCAL ID]=c,'open'))
ELSE [Comments]
ENDIF
for know it is populating empty cell only by "not signed yet" although connected row has in LOCAL ID a or b or even c.
Thanks,
Daniel
