The Spotfire Community is moving to TIBCOmmunity and this forum location has closed. During the transition, you can still search the old forums but posting has been disabled. We encourage you to pick up the discussion at the new Spotfire community on TIBCOmmunity.
X-Axis labels based on CASE WHEN statement - TIBCO Spotfire Community

X-Axis labels based on CASE WHEN statement

Last post Fri, Aug 19 2011 5:19 PM by Trent. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • Tue, Aug 9 2011 3:46 PM

    • Trent
    • Top 500 Contributor
    • Joined on Tue, Sep 21 2010
    • Posts 7

    X-Axis labels based on CASE WHEN statement

    I'm having trouble naming a custom expression that uses a CASE WHEN statement against a Document Property.  Below is the custom expression:

     <CASE "${ViewAxisBy}"
    WHEN "ControlEntry1" THEN [Field1]
    WHEN "ControlEntry2" THEN [Field2]
    ELSE [Field3] END>

    Ideally, I would like each CASE to have its own label corresponding to the field name.  At worst, I at least need to be able to supply a generic label like "X-axis".  I can't even manage the latter using the Display Name field in the Custom Expression form.

    btw - I'm using Spotfire 3.1

  • Tue, Aug 9 2011 6:29 PM In reply to

    Re: X-Axis labels based on CASE WHEN statement

    Hi Trent,

    I'm sorry, but I need a bit more background info on what you would like to achieve. There are some ways around the case statement in an X-Axis.

    Christof

    -----------------------------------
    Dr. Christof Gaenzler
    Sr Solutions Consultant
    TIBCO Spotfire
  • Tue, Aug 9 2011 7:22 PM In reply to

    • Trent
    • Top 500 Contributor
    • Joined on Tue, Sep 21 2010
    • Posts 7

    Re: X-Axis labels based on CASE WHEN statement

    Thanks for replying Christof.

    Specifically, we are basically talking about displaying information for a many-to-many relationship in trellised bar charts.  Just as an example, let's say something like total sales by store and manufacturer.  We might want to see sales Trellised by Store with each manufacturer listed in order of total sales or we might want to see sales trellised by Manufacturer with each store's total sales listed in order.  I have a third field in play so we can add in Region to the example.

    I'm using a dropdown box to change both the X-Axis and the Trellis simultaneously.  The dropdown includes:

    • Store By Manufacturer
    • Region By Manufacturer
    • Manufacturer By Store
    • Manufacturer By Region

    I have the logic working to change the X-axis and Trellis correctly using the above CASE statement and it works great.  However, the X-axis label is the quite hideous CASE statement and I can't even get it to be something generic like "x-axis".   Of course, the preference would be the ability to change the X-axis label to exactly what is being displayed.

  • Wed, Aug 10 2011 5:25 AM In reply to

    Re: X-Axis labels based on CASE WHEN statement

    So you change 2 things with one property control. Have you ever thought about using a bookmark instead?

    Christof

    -----------------------------------
    Dr. Christof Gaenzler
    Sr Solutions Consultant
    TIBCO Spotfire
  • Thu, Aug 11 2011 9:41 AM In reply to

    • Trent
    • Top 500 Contributor
    • Joined on Tue, Sep 21 2010
    • Posts 7

    Re: X-Axis labels based on CASE WHEN statement

     We are using Spotfire 3.1 and upgrading is not a possibility.  It looks like using a Bookmark to change property values is not availablein 3.1?

  • Thu, Aug 11 2011 9:55 AM In reply to

    Re: X-Axis labels based on CASE WHEN statement

    ...sorry, the new Bookmarks are in 3.3

    So: anyone has a solution for that for TS 3.1 ?

     

    Christof

    -----------------------------------
    Dr. Christof Gaenzler
    Sr Solutions Consultant
    TIBCO Spotfire
  • Fri, Aug 19 2011 5:19 PM In reply to

    • Trent
    • Top 500 Contributor
    • Joined on Tue, Sep 21 2010
    • Posts 7

    Re: X-Axis labels based on CASE WHEN statement

    I ended up with a bizarre resolution for my original problem and figured I would share it.  Half randomly, I added an "AS [name]" to the original custom expression:

    <CASE "${ViewAxisBy}"
    WHEN "ControlEntry1" THEN [Field1]
    WHEN "ControlEntry2" THEN [Field2]
    ELSE [Field3] END AS test>

    Spotfire accepted the expression and now the visualization displays "Test" as the x-axis label.  But when I open the expression again, it looks like this:

     <case "ControlEntry1" when "ControlEntry1" then [Field1] when "ControlEntry2" then [Field2] else [Field3] end>

    The "ControlEntry1" after the word case is the actual string from the property control, it is NOT the name of the property control.  And then the word "Test" is now in the Display Name field.  But it all mysteriously works.

    Mind you, I cannot create a new visualization and copy and paste the resulting custom expression.  I would have to copy the original CASE statement with the "AS test" part and allow Spotfire to save it in its bizarro way.

    Again, this is using Spotfire 3.1 so this issue may not exist in Spotfire 3.3.  But it's probably worth a look.

Page 1 of 1 (7 items)
©Copyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center