For utility of stacked fields, if you choose to go that way at all, simply make all the fields the same size and make the topmost one on the stack a button that launches a script. (remove the stacked fields from the tab order)
The launched script looks at whatever conditions you want, then ends in a "GoToField" step.
Now when a user clicks to put the cursor in the field...your script decides which of the fields to go to in the stack.
If doing this, you'llk also want the entry script or an OnModify script to clear values from the other fields.
Or you could use a tab control with one tab for entering imperial units and another tab for metric units.
Thanks for all your quick replies!
Jim, could you expand (or point me in the direction of a thread that explains) on what functions you would set-up to analyze the field correctly for the metric/imperial calculations? I'm not sure how to accomplish this. I'd like to learn how to do this, but I'm not sure it would work for this database, as I'm designing it for users who will be working very quickly, and I had split the FT and IN fields to ensure the calculation reads correctly if they forget to use the correct symbol (entering ' instead of " would render a false calculation, no?).
Ninja, for the stacked fields solution, I understand how this could control which field I'm entering data into, but how would it control which field is visible? Would I have to make all of the fields transparent? Say I enter data into the FT and IN fields, then switch modes to Metric. Ideally I'd like that spot on the layout to show a field with the metric conversion of the FT/IN I already entered, and then still have that field editable....and then behind the scenes, if I swtiched back to Imperial Mode, the FT and IN would update when I change the data in the Meters field.
So far I haven't been able to figure out how to set up 2 way calculations. example: edit Imperial field....Metric field calcs the conversion, then edit the metric field, and the imperial field updates.
Aah, so I also just tried PhilModJunk's solution....unfortunetely I can't use tab controls for this switch because the fields exist in a portal. The tab works on the first portal record, but does not show up on the others. Any ideas?
From your post, it looks like you want both fields on the layout (metric, imperial). That's actually easier...
have an OnObjectSave trigger launch a script for each field...when Imperial is saved, calculate the metric and SetField the metric.
When metric is saved, calculate and Setfield the Imperial.
No stacking necessary.
Sorry for slow response to a single field "interpretor" like FMP does on all calculations. I will point you in a direction to experiment, since you have a lot of restrictions you want in your DB behavior. The area of Power in FMP that is beneficial is TEXT FUNCTIONS. As a beginner, I would suggest a script, although many programmers love the "one liner" calculation. Scripting is easier to break down components of parsing and is easily extensible for future.
Lets focus on inches and feet and how "Friendly" you want program. The single entry text field we will call Ht, for ease of my typing. The first part is call "Standard Conditioning". You want to adjust the text Field Ht, so that your Interpretor parses consistantly.
We are going to allow only the characters quote [ ' ] and double quote [ " ] and small [ m ] and point [ . ] and default of NO characters is meters.
Possible user entries in BOLD....
34.6 ' 39 inches 34.6'39"
2 0 ' 20'
5 cm 5m
16 . 45 m 16.45m
5ft 10" 510" hmmmm??
7' 3m Error mixed units
wow what did he mean? To "Standard Condition", use FMP Filter fuctions to remove all non allowed characters , like blanks and permit ,only [ [ 01234567889 " ' m ]. The Ht text field after Filter and Substitute is shown italic. You can allow different cases, it you wish.
Now you must Parse.... and interpret. How did your mind just mentally flash the results? Program that!. I would "interpret " all to a consistant Decimal Meters result using Position function to find the Conditioned character and use Left function to extract the number part.
From here just program the script to calculate and convert and put the result into the Standardized Height field.
PS: See the mixed [ Errror ] and [ hmmmm?] ? You can fix [ hmmm ] that by allowing feet and inches in words. Simpley add [ i ] and [ f ] to the filter list and then Substitute [' for f] and [ " for i ].
Jim, I appreciate the explanation, I will experiment with that when I have a couple of hours to decipher it! To be completely honest, I think my mind exploded while reading it.
Ninja! Thanks for the idea! I did a test with an imperial and metric field side by side.....because both fields saving triggers the recalculation of the other, it seems to create a script loop where filemaker just freezes up trying to go between the two fields. Any recommendation on how I can script it so that the other script won't trigger upon recalculation?
I got the script triggers to work without a loop by setting an "exit script" depending on the Mode set in a global field ("Imperial" or "Metric Mode")
Now! To save space on the layout so that you only have to have one spot to enter the measurement, I tried the stacking trick Ninja mentioned (script trigger to go to field based on Imperial or Metric mode). I stacked the FT (field) IN (field) layout over the M (field).....and set conditional formatting to make the IN. text black when in Imperial mode (it's natural state would be transparent so it goes away when Metric mode is engaged).....but as you can see in the attached screenshot, the text doesn't become truly transparent....it is just white.
Screenshot below shows this:
1.me setting the text color to transparent
2. the artifact the transparent "IN" creates on the Meters field data when I go to browse mode
3. when I check the text color in layout mode again, it is WHITE now, it did not save my transparent selection...!!!????
Thanks S Chamblee. I checked out the file. I had not previously known about naming objects and scripting "go to object" to switch to a 0 width tab. This is great! Thanks!