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

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile
dv27
Level 2

17-01-2012

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.

Replies

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

18-01-2012

Can you please share your form? It's hard to determine how your form is designed and I don't have the time to rebuild it by myself.

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile
dv27
Level 2

18-01-2012

Sure, I can share it, but i'm not sure how. I dont see an option to upload a file to this message. Please let me know how to share and I'll do so. Thanks for your help!

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

18-01-2012

Use a file sharing service in the web such as Acrobat.com.

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile
dv27
Level 2

18-01-2012

Thanks! I just uploaded it to https://acrobat.com/#d=PwnUtMIB5OwKlPRnagr*UA

The object that I'm referring to is located at MIEexpSection.MIEexp.gsaTotal.

MIEexp is a repeatable subform.

Please let me know if you need anything else.

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

18-01-2012

You forgot to share the form, I cannot download it.

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile
dv27
Level 2

18-01-2012

sorry about that.

Try accessing it now: https://acrobat.com/#d=PwnUtMIB5OwKlPRnagr*UA

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

18-01-2012

In what field the calculated result should be shown?

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile
dv27
Level 2

18-01-2012

It should be shown in the gsaTotal field.

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

18-01-2012

Ok, so far I could follow your instruction the formula (FormCalc) for the field gsaTotal look like: