Hi all - I need some guidance on how to script adding n records based on values returned from a checkbox set.
Background: I have a student who's taking three courses: course_1, course_2, course_3. Each course has materials that the student can request. The courses are in the layout 'Courses' and are related via the student's (unique) Student ID. When staff get contacted for materials request, they click a button which takes them to a new layout, 'New Request'.
In this layout, I have a checkbox set that has its value list pulling from the related layout 'Courses'. This allows the staff to choose from which course the student needs materials (by checking the appropriate boxes).
Goal: When they click the 'Submit' button, the database will then add new records in another layout, 'Shipments', BUT it adds a separate record for each checked box in the value set, e.g. the student is requested material for course_1 and course_3 --> staff fill out their request form and check the checkboxes for course_1 and course_3 and click 'Submit' --> the script goes into the 'Shipments' layout and adds a new request for course_1 then adds a separate request for course_3.
What I've done: I created a trash_field with the following calculation: GetAsText ( Courses ) which replaces existing values and always evaluates.
Thought: I was thinking I could tell the script to look at the lines available in the trash_field and add one record for line 1 and loop to the next line, adding the record for that, and so on and so forth. But I'm not quite sure of the syntax. The other thing I did was I created trash_field_3 with the calculation ValueCount ( Courses ), again replacing existing values and always evaluating. I was thinking I could tell the script to duplicate the newly created record x times (based on that Value Count) but sets the field of those new records with the checked courses.
Any breadcrumbs would be really helpful.