redhotkoi Posted March 28, 2002 Posted March 28, 2002 I would like to be able to select a check box and have a serial no. appear in a field Thanks Andy
andygaunt Posted March 28, 2002 Posted March 28, 2002 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
Fitch Posted March 28, 2002 Posted March 28, 2002 It sounds like something you'd do with a calculated field: Case(Checkbox, SerialNumber)
redhotkoi Posted April 2, 2002 Author Posted April 2, 2002 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
Vaughan Posted April 2, 2002 Posted April 2, 2002 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.
Fitch Posted April 3, 2002 Posted April 3, 2002 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.
djgogi Posted April 4, 2002 Posted April 4, 2002 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
Recommended Posts
This topic is 8340 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