3 Replies Latest reply on Jan 11, 2016 11:06 PM by facaylar

    How to add new records based on value list in script

    facaylar

      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 ( Course ) 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,