Hello everyone
basicly i need to calculate two points for each students result
this->data['result']=this->data['point1']+this->data['point1'];
does not work with repeater it looks like because it is an array value now how can i reach this array values like mpoint1, point2 and result?
custom code is empty this where i should put some php cods i guess


basicly i need to calculate two points for each students result
this->data['result']=this->data['point1']+this->data['point1'];
does not work with repeater it looks like because it is an array value now how can i reach this array values like mpoint1, point2 and result?
custom code is empty this where i should put some php cods i guess



Yes you will need PHP. Don't put it in a loop event if you want the total of ALL the things they've added, put it in the loop and edit it if you're saving a new database entry for each Model.
Then you'll just use {var:php_name}
DON'T COPY PASTE FROM THE FORUMS.
$total = 0;
foreach($this->data("Model") as $entry) {
$total += $entry["point1"] + $entry["point2"];
}
return $total;
Then you'll just use {var:php_name}
DON'T COPY PASTE FROM THE FORUMS.
Thanks for anser
but i think it is not clear for me
are you telling to me, do not use loop event at all or just for calculation i need loop event
and how can make new connection
and how can i use this {var:php code]
??
but i think it is not clear for me
are you telling to me, do not use loop event at all or just for calculation i need loop event
and how can make new connection
and how can i use this {var:php code]
??
Well do you want to save each repeater entry on its own, or do you want to add ALL of them together?
User add student to evaluate with radio group points from 1 to 5
there is 16 questions
if user want to add another student evaluate again
finally when user send the document
it saves as stdent 1, point1,point2, result 70%
student 2, point1, point2, result, 80%
.....
depends on student number
this works without results
i cannot reach points to calculate them for each student
there is 16 questions
if user want to add another student evaluate again
finally when user send the document
it saves as stdent 1, point1,point2, result 70%
student 2, point1, point2, result, 80%
.....
depends on student number
this works without results
i cannot reach points to calculate them for each student
So each Model entry is saved individually then? In your loop event, in a PHP block
If you wanted to get the value directly from the data, it's just an array. So
$entry = $this->get("loop_event11.row.Model");Then you can use {var:php_name} (whatever you've called the PHP block) to get the returned $pointsTotal value.
$pointsTotal = $entry["point1"] + $entry["point2"];
return $pointsTotal;
If you wanted to get the value directly from the data, it's just an array. So
$model = $this->data("Model");
// Loop through it or...
$model[0]["point1"] etc etc
I dont know why but i think



$this->get("loop_event11.row.Model")does not work for me 😢




You didn't copy and paste that code did you? If you did delete it and type it manually.
If it still doesn't work, type
Also clear the data source from the save data action.
If it still doesn't work, type
print_r($this->get("loop_event35.row"));to see the data structure.
Also clear the data source from the save data action.
yes in copied before 🤗
now it turns result 0
if i enter 5 and 6 for example
technicly does not work from some reason again
moroever print_r does not turn anything
now it turns result 0
if i enter 5 and 6 for example
technicly does not work from some reason again
moroever print_r does not turn anything
right now
$total=$this->data['Model'][0]["point1"];is working but how can i increase 0 depends on model loop_event no kind of foreach or loop?
return $total;
Sorry in the loop it should be loop_event35.row.points1 + loop_even535.row.points2
I'm used to looping through data reads.
I'm used to looping through data reads.
from some reason get and set does not work with me maybe because my php version is 5.5
your answer loop_event35.row.points1 + loop_even535.row.points2 didint work if did corrrect
this code in php block in loop event
db_save is
result:{var:php17}
is working but basicly i connot change the results for another students multiplied from repeater
your answer loop_event35.row.points1 + loop_even535.row.points2 didint work if did corrrect
$model=$this->data['Model'];
$total=$model[0]["point1"]+$model[0]["point2"];
return $total;
this code in php block in loop event
db_save is
result:{var:php17}
is working but basicly i connot change the results for another students multiplied from repeater

Come on man help me out here.
$this->get("loop_event35.row.points1") + etc etc
$this->get("loop_event35.row.points1") + etc etc
This topic is locked and no more replies can be posted.