Jump 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.

Featured Replies

I would like to be able to select a check box and have a serial no. appear in a field

Thanks

Andy

Andy,

Its Andy. Can you run a script for this.

i.e. write a script that uses

Set field [check box, value]

Set field [serial no, value required]

Then apply this either to the actual field if it is only one item in the checkbox, or add a graphic button on top of the check box field.

Of course, then you may want to uncheck the check box.

So

If IsEmpty(checkbox)

Set field [check box, value]

Set field [serial no, value required]

Else

Set field [check box, ""

End IF

It sounds like something you'd do with a calculated field:

Case(Checkbox, SerialNumber)

  • Author

Something is not working

Here is the goal just incase you misunderstood what I needed.

I have field call "check box" I defined the field as a check box with a value list of "yes"

This is what I would like it to do. If check the "check box" in another field "sample door" I would like the next available number to appear. Lets say the last number used is "1012" "sample door" field should say "1013

I tried both and it didn' work

Andy & Flitch

Thank You

Andy

This is more complicated.

First thing: change the field name to something more descriptive. The name "checkbox" won't make sense in six months. What happens when you make another check box?

To do what you want will require a script to generate the serial number. In fact you probably don't even need a "yes" check box, a button called "serial no" would probably be just as good an interface: click on the button and a new serial number appears.

One way of doing it is to create a summary field (let's call it serialmax) that calculates the maximum of the serial no field. When the script runs it simply does a

Set Field [serial no, serialmax + 1]

There is a potential trap with this method: if the last record is deleted the next record could be given the same serial number. Some people think this is good, others think it's bad depending on whether you want to reuse serials or would rather guarantee uniqueness.

In case my original reply was not clear, you need 3 fields:

1. Checkbox, a text field, formatted as a checkbox, value list of "Yes" (or my preference, a number field with value list of "1")

2. SerialNumber, a number field, set to auto-enter a serial number

3. This calculated field:

Case(Checkbox, SerialNumber)

When you say it "didn't work," I have to assume you mean you don't like the fact that there will be gaps between serial numbers, because other than that it works ok.

Now then: you could do this with a script, but a calculation might still work for you.

Create a constant field, a calculation that = 1

Create a self-relationship constant::constant

Create another calc field, "max"... Max(self::SerialNumber)

SerialNumber should be a simple number field. In this example, have it auto-enter calculated data, NOT a serial number.

The auto-enter calc would be:

Case(Checkbox, max + 1)

It's true if you delete the very last record (the one with the highest serial number), the next record you create will have the serial number of the record that was deleted. Good to be aware of this, you'll have to decide if that matters for your application.

quote:

Originally posted by Andy H:

Something is not working

Here is the goal just incase you misunderstood what I needed.

I have field call "check box" I defined the field as a check box with a value list of "yes"

This is what I would like it to do. If check the "check box" in another field "sample door" I would like the next available number to appear. Lets say the last number used is "1012" "sample door" field should say "1013

I tried both and it didn' work

Andy & Flitch

Thank You

Andy

If you have FM5.5 than try to use the step

code:


SetField [sample door,GetNextSerialValue (dbname, fieldname)]

or calculation

sample door= if(checkbox="yes",GetNextSerialValue (dbname, fieldname),"")

where fieldname is your SN field and dbname the file it contains

HTH

Dj

Create an account or sign in to comment

Important Information

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

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.