Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How can one object perform different calculations in a repeatable subform?

Avatar

Former Community Member

I posted my question under a previous post, but am afraid it will be overlooked, so i'm posting it again in hopes of getting some much needed help.

I’m trying to apply a calculation to a numeric object. My calculations are dependent on:
1.      If a checkbox is checked
2.      The number of days entered
3.      The number of rows that are added (i'm using a repeatable subform)

Basically, if the first row is the ONLY row, then it can contain three possible calculations

  1. if a checkbox is checked and the total number of days entered is <= 2, then the calculation is.... partial.rawValue  * Days.rawValue 
  2. if a checkbox is checked and the total number of days entered is > 2, then the calculation is....perDiem.rawValue * (Days.rawValue - 2 ) + (partial.rawValue * 2) 
  3. otherwise, the calcuation is....perDiem.rawValue * Days.rawValue 

However, if more than one row is selected, then the first and the last row would contain the following possible calculations: 

  1. If a checkbox is checked, then the calculation is…perDiem.rawValue * (Days.rawValue - 1 ) + partial.rawValue  
  2. Otherwise, the calculation is…perDiem.rawValue * Days.rawValue  

The middle rows are always going to contain one possible calculation of…perDiem.rawValue * Days.rawValue

I have NO idea how to setup my script... i'm assuming that i need to create multiple variable (first row and last row), but have failed so far.

12 Replies