SOLVED Running calc depending on group repetition

Hi,

here's the thing: I want to use a repeating group for a timetable of installments. So in my form I have a field where you input amount of installments and then such amount of repeats appears below. Now is the tricky part: I use calc element in repeating group that devides the main amount of money by number of installments. The problem is - when I sum these installments, it nearly never gives the initial amount of money. You know - you have $10 and when you have 3 installments, you'll never gonna get these $10 with this method.

So I thought that maybe there is a way to program calc to make it devide the debt by amount of installments minus one and make the last iteration of calc use other method - substraction of the installments minus one from the initial amount of money, so the last installment would be slightly different, but would make the overall timetable correct.

Here's the question: is there a way to tell callc to behave differently on the last repetition of the group? If so - how?

Cheers,

Olek
 
Yep, I've started there, but obviously I'm not competent enough to actually access given repetition. I've tried various combinations of '{table___element}' with [number_of_repetition] with no luck. Help, please?...
 
I tested for you:
$formModel->getElementData is working and I think additionally you have all data in $data.
Did you use var_dump()? or
All posted data is stored in the array $data, this is useful if you wish to retrieve repeat group data. To get a debug output of this data you can use this php:
PHP:
echo '<pre>';
print_r($data);
echo '</pre>';
exit;
 
Nope, getElementData causes white screen with big error number at the center whenever I try to open my form.

However I managed to access the desired group iteration with:

$somevariable = $data['table___element'];
return $somevariable[iteration_number];

Simple as that, but since my programming skills are highly laughable, it wasn't obvious for me at all.

Anyway - thank you for your time and patience, troester!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top