AnsweredAssumed Answered

Create multiple new records by making check-box selections from two tables

Question asked by d.b on Oct 1, 2011
Latest reply on Oct 4, 2011 by philmodjunk

Title

Create multiple new records by making check-box selections from two tables

Post

About a year ago I received some great help setting up a comment entering script for my teacher grades database.  Here is a link to the thread:

http://forums.filemaker.com/posts/f686b6195d

 

That script has served me well, but I would now like to be able to enter comments for multiple students at once and possibly multiple stuents at once if easily workable.  The current script selects from a table of comments or a newly entered comment.

 

I would like to be able to select multiple students from the current class (I am guessing he best way would be with an additional checkbox field) and record the same comment for all students checked at once.

I'm not sure if it would be easy to create a script that also allows for multiple comments to be selected (I am guessing from another portal).  I would like to enter those comments individually (not concatenated) as some comments have a score attached to it.  And then to loop through each comment and each student and clear the check boxes when the script is completed.

I was going to try creating the script myself and loop through every student and every comment, but then I realized that I could save some processing by first doing a find based on the check boxes, but then I thought there may be an even better method that I haven't thought of.  I make hours of mistakes with syntax before I get things working correctly when working with scripts, so it would be awesome if anyone has the time to put together a sample of what the script would look like (PhilModJunk did that for me last year and it was wonderful).

 

I've uploaded an image that shows the current script that records individual comments one at a time in case the text below is not clear.

RecordComment

If [ not IsEmpty ( Enrollment_StudentsAndClasses::Student ID ) ] If [ not IsEmpty ( Scores::Comment) ]

Show Custom Dialog [ Title: "Confirm Entry"; Message: StudentInfo 2::First Name & " " & StudentInfo 2::Last Name & " -- " & Scores::Comment; Buttons: “OK”, “Cancel” ]

If [ Get ( LastMessageChoice ) = 2 ] Set Field [ Scores::Comment; "" ]

Exit Script [ ] End If

Freeze Window Set Variable [ $StudentID; Value:Scores::StudentID ] Set Variable [ $AssignmentID; Value:Scores::AssignmentID ] Set Variable [ $Comment; Value:Scores::Comment ] Set Variable [ $ScoreID; Value:Scores::ScoreID ] Set Variable [ $CommentValue; Value:Scores::CommentValue ] Set Variable [ $CommentType; Value:Scores::CommentType ] Set Field [ Scores::Comment; "" ]

Go to Layout [ “CommentsSpecified” (CommentsSpecified) ] New Record/Request Set Field [ CommentsSpecified::Comment; $Comment ]

Set Field [ CommentsSpecified::CommentValue; $CommentValue ]

Set Field [ CommentsSpecified::CommentType; $CommentType ]

Set Field [ CommentsSpecified::AssignmentID; $AssignmentID ]

Set Field [ CommentsSpecified::StudentID; $StudentID ]

Set Field [ CommentsSpecified::ScoreID; $ScoreID ]

Go to Layout [ original layout ] End If

End If

Screen_shot_2011-10-01_at_6.51.46_PM.png

Outcomes