Jump to content

Script which sets a field as the lowest number of several other fields


This topic is 4166 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello. I want to run an occasional script which says:

Make Field 1 the same value as the lowest of Fields 2, 3, 4, 5 and 6.

So if I had:

Field 2 = 27

Field 3 = 7

Field 4 = 236

Field 5 = 85

Field 6 = 103

The script would put 7 in Field 1

Anyone know how to do it?!

Thanks

Philip

Link to comment
Share on other sites

If you have several fields which contain numbers which share the same purpose or relation then they should be records instead of fields if those fields contain regular information. But if you need it I think it could be like this Min ( field2 ; field3 ; field4 ... etc ) but you probably don't need script either and can use calculation type or auto-enter replace type on field1.

Still, maybe those that know more will explain why it is important to use records. I know it IS important because I read it here all the time and I know they are right but I don't always know why. :laugh:

  • Like 1
Link to comment
Share on other sites

Still, maybe those that know more will explain why it is important to use records. I know it IS important because I read it here all the time and I know they are right but I don't always know why. :laugh:

One reason it's best to use records for things that are alike* is that records can easily be organized into sets (found or related) and these sets in turn are easy to sort and aggregate.

Another point is that 5 is not a magic number. When you have 5 of something, you are likely to also have 3 or 4 and - eventually - 6 or 7. Now, records are very easy to add by the user, while adding fields requires the developer to change the schema.

---

(*) Numbered fields are almost always an indication that you are dealing with several things that are alike.

Edited by comment
  • Like 3
Link to comment
Share on other sites

This topic is 4166 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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