
In For - Where - Do Script - Add a loop
Hi,
I'm struggling with an issue. I'm using a for-where-do script to look for the specific Students concerned with an Exam (an Exam is connected to only one Course, so I look for Students where Course = s), and automatically create records in another Individual_Assignement table, where it creates a line associating Student_name, Exam_name with the last column is Grade, which will be manually assigned to the teacher.
I want to add an extra column to this Individual Assignement table, an Individual Assignment for each Individual Assignment, different from its ID.
I tried this formula :
let s := this;
let number := 1;
for p in select Course where Course = s.Course do
let number := number + 1;
let a := (create Individual_Assignment);
a.(Student_Course := p);
a.(Exam := s);
a.(assignement_number := number)
let number := number +1
void
end
The code works great, and creates the appropriate lines, for each Student and its Individual Assignment. The problem is that my number counter loop does not work : all Individual Assignements are set to 1, meaning that the let number := number + 1 is not taken into account.
Could anyone suggest a workaround ?
Thanks !
P.
-
You should use first
let number := 1 ;
to set number variable and its initial value.then use only
number := number + 1 ;For instance the following code:
let arr := ["a", "b", "c"];
let number := 1;
for i in arr do
let number := number + 1 ;
number
endproduces the following output in Console:
2
2
2While with this code:
let arr := ["a", "b", "c"];
let number := 1;
for i in arr do
number := number + 1 ;
number
endyou get:
2
3
4 -
Hello, I'm a college professor from KEDGE Business School (Talence, France) and I stuggle to understand the Ninox script language from the manuals. I spent much time on it, when I had students taking late exams (which is quite often) and I had to re-enter the answers and then assign (again) constant value. Though it does help me keep track of my online students. Where can I find the tutorial for the Individual_Assignement table? Thanks.
https://ninoxdb.de/en/manual/tables/table-references-and-relations https://theessayservice.org