Conditional rendering of rich text component fields

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
I am trying to build a dashboard using Skuid and am using Rich Text components to display budget goals vs. actuals and the associated variance amount and variance %. I would like the variance amount & % to display in red if negative & in green if positive. I have tried having two components and using rendering to only show them if the amount is < 0 or > 0 based on the formatting. But, I can't seem to get it to work. The variance amount and variance % fields are custom formula fields I have setup in Salesforce. The rendering basically shows it or doesn't show it, regardless of the value. Am sure I am just missing a step. And I am very new to Skuid. This is my first project in Skuid. Any tips?
Photo of Stacey Thorne

Stacey Thorne

  • 102 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Christine Jessen

Christine Jessen

  • 670 Points 500 badge 2x thumb
Hi Stacey!  

Thanks for your question, there are a few ways to go about this.  I like your idea of the conditional rendering on two components, and that should work!  

Can you take a screenshot of your rendering conditions?  One thing to confirm is that you have checked the variance fields in the model itself to bring it into the Skuid UI.  If it's not checked in the model, then the conditional rendering is basically looking at a null value.

Thanks!
Christine
(Edited)
Photo of Stacey Thorne

Stacey Thorne

  • 102 Points 100 badge 2x thumb
Hi Christine. Thanks for replying. I think I figured it out. The fields were part of an aggregate model. I realized for this particular use case, I don't need an aggregate model, so I changed it to basic and the same rendering setup worked! Not sure why the aggregate model rendering didn't work. I'd love to know any other tips for conditional rendering if you have a few. Thanks for your help!
Photo of Christine Jessen

Christine Jessen

  • 670 Points 500 badge 2x thumb
Awesome Stacey, glad you figured it out!

Remember, when using aggregate models, in order to reference the fields, you need to use the field alias name instead of the field API name.  This may take a little XML hacking to work in conditional rendering.  See this previous post from Rob that describes how to go about conditional rendering with aggregate models:

https://community.skuid.com/skuid/topics/conditional-rendering-based-on-sum-in-aggregate-model

Hope this helps!  
Photo of Stacey Thorne

Stacey Thorne

  • 102 Points 100 badge 2x thumb
Thanks for the link. I can see this being needed when I have to create the management version of this dashboard.