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.

Dim text in one field based on condition of another?

Featured Replies

Hi Filemaker Gurus!

I have an OutsourcePrice field, a MaterialCost field and a LabourCost field all on the same table. How do I set up a condition that if the OutsourcePrice Is not empty, then the text color in the other two fields changes from black to a light grey?

I want the user to be able to see what our cost was (in light grey text) even if we end up going with an outside provider for the product, and have a price entered in the Outsource Price field.

Conditionally format each of the two fields with the calc

not IsEmpty(OutsourcePrice)

with a text colour of light grey

Hi Filemaker Gurus!

I have an OutsourcePrice field, a MaterialCost field and a LabourCost field all on the same table. How do I set up a condition that if the OutsourcePrice Is not empty, then the text color in the other two fields changes from black to a light grey?

I want the user to be able to see what our cost was (in light grey text) even if we end up going with an outside provider for the product, and have a price entered in the Outsource Price field.

see if this file will help.

Lee

skearton.fp7.zip

  • Author

see if this file will help.

Lee

Thank you all once again! Nice and elegant. Didn't know how to do the formula part within the conditional format, so now at least I understand the method.

Once other question that I can't solve. Trying to do a validation on a height field, so that if the user enters a fraction like 1-1/2, the validation will strip the dash and and replace it with a character space out of the entered value so that it looks like this: 1 1/2. Then a custom function I found on Brian Dunning's website will work correctly in translating it into a decimal number for further calculations of area etc.

Trying to do a validation on a height field, so that if the user enters a fraction like 1-1/2, the validation will strip the dash and and replace it with a character space out of the entered value so that it looks like this: 1 1/2. Then a custom function I found on Brian Dunning's website will work correctly in translating it into a decimal number for further calculations of area etc.

Use the Filter (field) and use "0123456789 /" as the text to be filtered. A fraction like this is really text.

HTH

Lee

  • Author

OK, tried that but now my field is displaying 11/2, when I need the space inputted so it reads like 1 1/2. What am I missing? Does it matter if the calculation is on the auto enter calc or the Validation calc?

OK, tried that but now my field is displaying 11/2, when I need the space inputted so it reads like 1 1/2. What am I missing? Does it matter if the calculation is on the auto enter calc or the Validation calc?

You are correct, I should have put a substitute in to replace the hyphen

Filter ( Substitute ( text ; "-" ; " " ); "0123456789 /")

Lee

  • Author

You are correct, I should have put a substitute in to replace the hyphen

Filter ( Substitute ( text ; "-" ; " " ); "0123456789 /")

Lee

You ROCK! Thank you so much for taking the time. Now to account for another possible human error, what if the user does this 1 - 1/2; in other words they enter extra spaces before or after the dash or both?

I tried: Filter ( Substitute ( text ; " - " ; " " ); "0123456789 /"), which works if there are the extra spaces before or after the dash, but now if they enter it like 1-1/2, I'm back to 11/2.

Errr, why not get the user to enter "1.5"?

  • Author

Errr, why not get the user to enter "1.5"?i

Yeah, that was my plan, but I have to make this as idiot proof as possible, and some are used to entering fractions. What I have been given above is bigger step than what I had, but I thought if there was a way to also compensate for the last listed possibility, then I'm covered. What I have found, unfortunately, is it is better to try and accommodate the user, than to try and train them.

just add a new condition to the substitute


Filter ( Substitute ( text ; 

["-" ; " " ] ;

[ "   "; " " ]  



); "0123456789 /")

Note that there are three spaces in the Search, and one in the Replace.

Lee

Yeah, that was my plan, but I have to make this as idiot proof as possible, and some are used to entering fractions. What I have been given above is bigger step than what I had, but I thought if there was a way to also compensate for the last listed possibility, then I'm covered. What I have found, unfortunately, is it is better to try and accommodate the user, than to try and train them.

You can accommodate both with something like this, requires some sort of separator between the whole number and fraction.

Case ( PatternCount ( Number ; "/" ) ; Evaluate ( Substitute ( Number ; [ " " ; "+" ] ; [ "-" ; "+" ] ) ) ; Number )

Errr, why not get the user to enter "1.5"?

I agree with Vaughan. The time to deal with this problem is now.

I have to make this as idiot proof as possible, and some are used to entering fractions

There is no such thing. LOL

Why not just force them to use only numbers through the options for the number fields, i.e. use the Validate on a true Number result field. and then use a message that tells them that "Fractions have to be entered as decimals (i.e. .5 or .33333 etc)".

HTH

Lee

I agree with Vaughan. The time to deal with this problem is now.

There is no such thing. LOL

Why not just force them to use only numbers through the options for the number fields, i.e. use the Validate on a true Number result field. and then use a message that tells them that "Fractions have to be entered as decimals (i.e. .5 or .33333 etc)".

HTH

Lee

FWIW, For simple fractions doing the calc in your head is fine, but I use the evaluate to accommodate quick entry of fractions such as 11/32 or 5/16. A big help if someone is doing data entry.

IMHO, users should enter what they know and leave calculations to the computer. However, "quick entry" and "idiot proof" are often incompatible. Ideally, they would enter such data into three separate number fields (integer, numerator and denominator).

However, "quick entry" and "idiot proof" are often incompatible.

Well said. Can I quote you on that? ;)

Can I quote you on that?

Who else would you quote on that?

  • Author

Who else would you quote on that?

I guess, because I'm the poor soul who has to review the shop production orders before they go to manufacturing, in the end makes it easier for me to try and automate this. I get SO TIRED of having to go back to them and say, please enter it this way...esp. since I have already told them 50 times already...sigh.

So, another question to try to finalize this scripting. How does one tell filemaker to look a text field and say "if the text string contains "/" then do this?

I have separated the entry for the Height and it's type of measurement (H_unit). The H_unit is a drop down list that lets the user select either "mm" or "in". I need a calculation that runs when the user selects the H_unit, and then modifies the Height measurement.

We are trying to force the use of fractional numbers if "in" is selected and force the use of a decimal number if "mm" is used.

For, example, the user enters 6.5 in the height measurement and then selects the "in" in the H_unit, the calc needs to change the display of the number to 6 1/2. If they enter the same number but the H_unit is "mm" then it is left as 6.5. If they enter 6 1/2 and then choose "mm" it needs to change to 6.5. I have grabbed some custom functions that do the conversions, but I just need to know how to tell filemaker to do the "if the text string contains "/".

how to tell filemaker to do the "if the text string contains "/".

The PatternCount() function does that.

See also:

http://fmforums.com/forum/topic/56681-convert-decimals-to-fractions/page__p__267775#entry267775

  • Author

Thank you all! What would us newbies do without our filemaker angels?

Download a copy of the FMP Script Guide and Function Guide pdf documents, they have all the scrip steps and functions listed.

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.