![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have inherited a file. The original creater has a lot of fields like this Length(GetAsText(GetAsNumber(Start Number))) ? 4 Where Start Number is defined as a number. Why he/she has done this double getastext/getasnumber is a mystery to me. Is there any reason I can't see why these are there? Since I don't know who originaly made this I can ask him. |
\
#3
| |||
| |||
|
|
In article <45a17753$0$27166$dbd45001 (AT) news (DOT) wanadoo.nl>, "Ursus" ursus.kirk (AT) wanadoo (DOT) nl> wrote: I have inherited a file. The original creater has a lot of fields like this Length(GetAsText(GetAsNumber(Start Number))) ? 4 Where Start Number is defined as a number. Why he/she has done this double getastext/getasnumber is a mystery to me. Is there any reason I can't see why these are there? Since I don't know who originaly made this I can ask him. Without seeing the entire database, it looks pointless to me too. GetAsNumber on a Number field is a waste of time - it's already a number. \ |
|
Depending on what the "?" charcter really is, it may also be a waste of time changing it to Text to get a length when simply comparing it to a number will work. If the "?" is really the single form of ">=" then you can just use Start Number >= 1000 to make sure there are four or more digits. |
#4
| |||
| |||
|
|
Helpful Harry wrote: In article <45a17753$0$27166$dbd45001 (AT) news (DOT) wanadoo.nl>, "Ursus" ursus.kirk (AT) wanadoo (DOT) nl> wrote: I have inherited a file. The original creater has a lot of fields like this Length(GetAsText(GetAsNumber(Start Number))) ? 4 Where Start Number is defined as a number. Why he/she has done this double getastext/getasnumber is a mystery to me. Is there any reason I can't see why these are there? Since I don't know who originaly made this I can ask him. Without seeing the entire database, it looks pointless to me too. GetAsNumber on a Number field is a waste of time - it's already a number. \And Length will return the number of characters in a field whether it's a text field or a number field. "Length(GetAsText(GetAsNumber(..." seems pointless. It could just be "Length(field)" There must be more going on behind the scenes. |
|
Depending on what the "?" charcter really is, it may also be a waste of time changing it to Text to get a length when simply comparing it to a number will work. If the "?" is really the single form of ">=" then you can just use Start Number >= 1000 to make sure there are four or more digits. Unless they wish to allow "0" as a leading character, in which case a Length statement will do nicely. |
#5
| |||
| |||
|
|
In article <Jggoh.100$B25.85 (AT) news01 (DOT) roc.ny>, Vandar vandar69 (AT) yahoo (DOT) com> wrote: Helpful Harry wrote: In article <45a17753$0$27166$dbd45001 (AT) news (DOT) wanadoo.nl>, "Ursus" ursus.kirk (AT) wanadoo (DOT) nl> wrote: I have inherited a file. The original creater has a lot of fields like this Length(GetAsText(GetAsNumber(Start Number))) ? 4 Where Start Number is defined as a number. Why he/she has done this double getastext/getasnumber is a mystery to me. Is there any reason I can't see why these are there? Since I don't know who originaly made this I can ask him. Without seeing the entire database, it looks pointless to me too. GetAsNumber on a Number field is a waste of time - it's already a number. \And Length will return the number of characters in a field whether it's a text field or a number field. "Length(GetAsText(GetAsNumber(..." seems pointless. It could just be "Length(field)" There must be more going on behind the scenes. True. You can use many Text functions on Number fields (and vice-versa) since FileMaker is fairly forgiving about data types. But it's rather pointless - you may as well simply test against a number rather than use Length. Depending on what the "?" charcter really is, it may also be a waste of time changing it to Text to get a length when simply comparing it to a number will work. If the "?" is really the single form of ">=" then you can just use Start Number >= 1000 to make sure there are four or more digits. Unless they wish to allow "0" as a leading character, in which case a Length statement will do nicely. Although you can format a Number field to display leading zeros, they aren't actually stored, so the Length function on a Number field will only give the number of actual digits in the number without any leading zeroes (or trailing zeroes after the decimal point). Because of this the original over-complicated calculation above won't tell you about leading zeros. |
|
If you want to utilise leading zeros in any way other than displaying them, then you have to use a Text field to store your numbers rather than a Number field ... or every time you want to know you could use a calculation like: Right ("00000" & NumberField, RequiredDigits) Either way you can then use the Length function. It gets a little more complicated if you want both leading and trailing zeroes since you have to work out where the decimal point is. |
#6
| |||
| |||
|
|
Helpful Harry wrote: In article <Jggoh.100$B25.85 (AT) news01 (DOT) roc.ny>, Vandar vandar69 (AT) yahoo (DOT) com> wrote: Helpful Harry wrote: Depending on what the "?" charcter really is, it may also be a waste of time changing it to Text to get a length when simply comparing it to a number will work. If the "?" is really the single form of ">=" then you can just use Start Number >= 1000 to make sure there are four or more digits. Unless they wish to allow "0" as a leading character, in which case a Length statement will do nicely. Although you can format a Number field to display leading zeros, they aren't actually stored, so the Length function on a Number field will only give the number of actual digits in the number without any leading zeroes (or trailing zeroes after the decimal point). Because of this the original over-complicated calculation above won't tell you about leading zeros. I was assuming that leading zeroes were entered into the field, not included through number formatting. With number formatting, you are exactly right. With data entry of leading zeroes, Length will count them. (It will also count a manually entered decimal point) |
)
#7
| |||
| |||
|
|
In article <P8Woh.255$B25.18 (AT) news01 (DOT) roc.ny>, Vandar vandar69 (AT) yahoo (DOT) com> wrote: Helpful Harry wrote: In article <Jggoh.100$B25.85 (AT) news01 (DOT) roc.ny>, Vandar vandar69 (AT) yahoo (DOT) com> wrote: Helpful Harry wrote: Depending on what the "?" charcter really is, it may also be a waste of time changing it to Text to get a length when simply comparing it to a number will work. If the "?" is really the single form of ">=" then you can just use Start Number >= 1000 to make sure there are four or more digits. Unless they wish to allow "0" as a leading character, in which case a Length statement will do nicely. Although you can format a Number field to display leading zeros, they aren't actually stored, so the Length function on a Number field will only give the number of actual digits in the number without any leading zeroes (or trailing zeroes after the decimal point). Because of this the original over-complicated calculation above won't tell you about leading zeros. I was assuming that leading zeroes were entered into the field, not included through number formatting. With number formatting, you are exactly right. With data entry of leading zeroes, Length will count them. (It will also count a manually entered decimal point) A quick test proves we're both wrong. )A Number field left to a display format of "General" does display leading zeros typed into it (and therefore I was wrong since it must also store them), but they are not counted by the Length function. NumField = 05 Length(NumField) = 1 TxtField = "05" Length(TxtField) = 2 Trailing zeros are ignored, as is the decimal point itself. NumField = 5.0 Length(NumField) = 1 TxtField = "5.0" Length(TxtField) = 4 NumField = 05.05 Length(NumField) = 4 TxtField = "05.05" Length(TxtField) = 5 Note: The test was done in FileMaker 5.5 which is the newest version on this particular Mac. This behaviour may be a bug that since been fixed in newer versions. |
![]() |
| Thread Tools | |
| Display Modes | |
| |