Conditional Rendering Model Property number of rows issue

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
The new conditional rendering features added to the Dreamforce release are killer, thank you!

Came across an issue related to the proper evaluation of a conditional rendering property marked to number of rows in model.  In appears that the evaluation is using === / !== and unfortunately the data types are different (data.length is numeric while the value from the xml is string).  This results in incorrect evaluation.

Steps to reproduce:
1) Create a new detail page for Account
2) Remove everything except page title
3) Add 3 templates
- First template with text "Show if RowCount == 1" set to conditionally render when # of rows in Account equals 1
- Second template with text "Show if RowCount != 1" set to conditionally render when # of rows in Account does not equal 1
- Third template with text "{{$Model.Account.data.length}}"
4) Preview the page picking an account when prompted

Actual Result
Template #2 appears

Expected Result
Template #1 appears

Repro Page
<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
         </fields>
         <conditions>
            <condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="Account">
         <maintitle>
            <template>{{Name}}</template>
         </maintitle>
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions/>
      </pagetitle>
      <template multiple="false" model="Account">
         <contents>Show if RowCount == 1</contents>
         <renderconditions logictype="and">
            <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="true" fieldmodel="Account" sourcetype="modelproperty" nosourcerowbehavior="deactivate" sourceproperty="data.length" value="1"/>
         </renderconditions>
      </template>
      <template multiple="false" model="Account">
         <contents>Show if RowCount != 1</contents>
         <renderconditions logictype="and">
            <rendercondition type="fieldvalue" operator="!=" enclosevalueinquotes="true" fieldmodel="Account" sourcetype="modelproperty" nosourcerowbehavior="deactivate" sourceproperty="data.length" value="1"/>
         </renderconditions>
      </template>
      <template multiple="false" model="Account">
         <contents>Row Count = {{$Model.Account.data.length}}</contents>
      </template>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks Barry. We've  recreated the error and will work to fix as soon as we can.  As usual - appreciate how thorough your bug reports are. 
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
The issue has been resolved in the upcoming Skuid Winter 15 release, we'll see if we can get this into an upcoming patch of Skuid Summer 14.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb
Lightening fast as always, thanks Zach!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb
Hi guys - This appears to still be an issue with 6.8.7.  Any updates?
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Not sure if this was ever fixed or if it was a regression, but it has been fixed now.  It will be available in the next patch release.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Awesome, thanks Ben!
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
This has been fixed in Skuid 6.8.8 available on the Skuid Releases page.

http://www.skuidify.com/skuidreleases

Let me know if this resolves the issue.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Tested and confirmed with 6.8.8.  Thanks Ben!