Jump to content
  • 0

How select multiple rows in one table and add rows to a third tables



I have the classic school environment with classes and students, where class subscriptions are to be managed and each student can be enrolled on more than one classes. Up to now I have this environment:

TABLES: one for students, one for classes and one that realise the many to many relation between them called enrollments.

With one data page adding a record into the third table I can select the course and the student to be enrolled (It is very similar to the caspio video about triggers and tasks). But this heavy to handle when hundreds of students are to be enrolled.

I whish  to be able to select from students table all the student to be enrolled in a class, then it should have to add as many rows as selected students into the third table with the id of each student and the class Id.  I tried combining an hidden field into the student table allowing to bulked it it, and a trigger on the update event, but I do not know how clear the field after the inserti is done.
Anyone has been faced with this problem?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Thank you @Meekeee! Because in order to provide you the answer I found the culprit: I was referring a var instead of a field, so I was clearing the var instead of the field.

Let me share a trick I found very useful to debug triggers:

1) I setup log table (my is i2e_log) with the fields: timestamp; Event; Source; Description

2) Then I inseret into specific points this insert with fiedls filled with var, messages or fields I want to check.


Thank you again. I would have another question but it is matter for another topic.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...