Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple Incrementing script won't work!!!

Featured Replies

  • Newbies

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 by Guest

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.

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.

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 by Guest

And if a student doesn't pass?

Then the calculation needs to take that into account - as SHOULD the script.

  • Author
  • Newbies

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

  • Author
  • Newbies

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

  • Author
  • Newbies

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

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.