Newbies Sunrise Posted October 10, 2006 Newbies Posted October 10, 2006 (edited) I have a created a database with students and and all their tests. I need to run a script to change the grade because of the new school year. I created a script, but it still changes the grade 12 to 13 and keeps incrementing everytime I run the script. Below is what I created. What I need is a script that increments by 1, but stops at 12. I am only a novice/beginner. I'm hoping someone can find my error or correct me. Go to Layout ["Student Records"(Student Data)] Show All Records Go to Field [student Data::Grade] If[student Data::Grade < 12] Replace Field Contents[No diag;Student Data::Grade +1] Go to Record/Request/Page[Next] End If Thanks for all your input. Sunrise Edited October 10, 2006 by Guest
Ender Posted October 10, 2006 Posted October 10, 2006 The condition would need to be inside the Replace[]. But I'd advise you to change this whole process a bit so this type of thing won't be necessary. Instead of a static Grade field, use a Graduation Year field. You can calculate the Grade from that if you wish. This way you wouldn't need to change the Grade every year. You might also consider changing your structure to allow an Enrollment record for each student for each year. Anyway, there's plenty of old discussions about this sort of thing, so you can do a search if you wish.
comment Posted October 10, 2006 Posted October 10, 2006 Replace Field Contents[] works on ALL records in the found set. The condition you have set up looks at the current record only. If that record happens to have 12 in the Grade field, nothing will happen. If not, the script will proceed and add 1 to all records, regardless of their value. You could try it this way: Go to Layout ["Student Records"(Student Data)] Show All Records Replace Field Contents [ Student Data::Grade ; Replace with calculation: Min ( Student Data::Grade + 1 ; 12 ) ] [ No dialog ] But I am puzzled if the grade cannot be just calculated automatically from the current date.
LaRetta Posted October 10, 2006 Posted October 10, 2006 (edited) But I am puzzled if the grade cannot be just calculated automatically from the current date And if a student doesn't pass? Calculation would make more sense but it might get complex, ie, skipping grades and so forth. We don't even know the structure much less the fields available to make those determinations. It could certainly be calculated for those records being looped but ... Upon re-read, it doesn't look those issues are being taken into account. :wink2: Edited October 10, 2006 by Guest
comment Posted October 10, 2006 Posted October 10, 2006 And if a student doesn't pass? Then the calculation needs to take that into account - as SHOULD the script.
Newbies Sunrise Posted October 10, 2006 Author Newbies Posted October 10, 2006 Thanks for the advise. I didn't think of that. I just got thrown into this project and will definitely work on what you said. Sunrise
Newbies Sunrise Posted October 10, 2006 Author Newbies Posted October 10, 2006 Thank you so much!! It worked... of course it did! I figured I needed something with that min function, but didn't understand how to make it work. Thanks again and I really appreciate the help. Sunrise
Newbies Sunrise Posted October 10, 2006 Author Newbies Posted October 10, 2006 You're puzzled because I didn't really know what I was doing when I started. It was a project dropped in my lap, so I bought the Missing Manual and away I went. I just ordered another book. I won't be a novice for long. Thanks for all your input. Sunrise
Recommended Posts
This topic is 6968 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now