8 Replies Latest reply: Dec 4, 2017 8:57 AM by Martha Parsons RSS

    If(Only creating expression

    Martha Parsons

      Hello,

       

      I have this if(only expression that was used to color code if the droute was the same or different.

      If(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE), RGB(0,134,182), RGB(231,104,25))

       

      They wanted to be able to separate out (toggle back and forth between 'same' and 'different'. So I created this:

      =If(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE),'Different','Same') as an expression.

       

      Problem is the null values for the other expressions are showing because every cell is filled out same or different. I tried to create a dimension using this

       

      =Aggr(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE),'Different')

       

      but I get an error back. It comes back as // Error in calculated dimension

      I was going to do one for 'Same' then create it conditionally based on what the radio button selected.

       

      Thank you,

      Martha

        • Re: If(Only creating expression
          Sunny Talwar

          May be use an if statement from an expression which works

           

          If(ExpressionLabelforExpression1 <> 0,

          If(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE),'Different','Same'))

           

          or this

           

          If(Len(Trim(ExpressionLabelforExpression1)) > 0, If(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE),'Different','Same'))

            • Re: If(Only creating expression
              Martha Parsons

              The second works as an expression, but my goal is to use as a dimension. My thought was then I can click "Suppress When Value is Null'.

              I created a listbox and when the user selects 'Different', I  only want the 'Different' bars to show up. Same with 'Same'.

              I already have expressions that are using the conditional box. And I already have a toggle button utilizing the Layout tab under conditional, so I can't use that.

               

              Right now, when I click on Different, the other values in the other expression are showing. Is there a way to say if expression label B is null then do not show this bar?

            • Re: If(Only creating expression
              pradosh thakur

              may be this

               

              if(len(trim(label_which has_null)>0 ,if(expression_name_you_wrote='Diffrent',RGB(0,134,182), RGB(231,104,25)) )


              check spelling errors


              regards

              Pradosh

                • Re: If(Only creating expression
                  Sunny Talwar

                  I don't think color expression needs to change pradosh. Color expression only display colors for the rows which are displayed.

                    • Re: If(Only creating expression
                      pradosh thakur

                      What i thought is if the null values are showing up then len(trim()) will eliminate that and wot show the color and if same then first color and if different then other?

                       

                      is it wrong? then i shall delete so others shall not be misinformed.

                       

                      regards

                      Pradosh

                        • Re: If(Only creating expression
                          Sunny Talwar

                          It is not wrong... what I am saying is that for color expression you can only use this

                           

                          if(expression_name_you_wrote='Diffrent',RGB(0,134,182), RGB(231,104,25))

                           

                          and not really need to use this condition -> if(len(trim(label_which has_null)>0... this is because if your expression doesn't show anything where len of label_which has_null = 0, then your color won't really show that either... so in order to get rid of the extra rows, I would use that in the expression, not in the color.


                          Does that make sense?

                            • Re: If(Only creating expression
                              Martha Parsons

                              I figured out the answer. I apologize it took so long to post.

                               

                              pick(match(GetFieldSelections(_Route),'All','Same','Different')

                              ,(Min({$<SITE={$(=bSite)}>} FARE) - Min({$<SITE={$(=cSite)}>} FARE))

                              ,If(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE),0, (Min({$<SITE={$(=bSite)}>} FARE) - Min({$<SITE={$(=cSite)}>} FARE)))

                              ,If(Only({$<SITE={$(=bSite)}>} DROUTE) & Only({$<SITE={$(=bSite)}>} RROUTE) <> Only({$<SITE={$(=cSite)}>} DROUTE) & Only({$<SITE={$(=cSite)}>} RROUTE), (Min({$<SITE={$(=bSite)}>} FARE) - Min({$<SITE={$(=cSite)}>} FARE)),0)

                              )