Jump to content

Dim text in one field based on condition of another?


skearton
 Share

This topic is 4324 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 )

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 "/".

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 4324 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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