Link to home
Create AccountLog in
Avatar of DMRyan
DMRyan

asked on

Change font color based of field value and convert date to text in lotus notes formula language.

I want to change the font color to red base on the field value and I also need to convert a date field to text.

When I tried @Text I received an error:

@Command([EditInsertText]; + "Date of Request:  " +  @Text(DateReceived +
@NewLine + @NewLine));

Date of Request:  Incorrect data type for operator or @FunctionSubject:  

If the field Impact has a value of "High" then I want the font to be red.

@Command([EditInsertText]; + "Impact:  " + Impact +
@NewLine + @NewLine);
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Remove the + right before "Date of Request", and also before "Impact".

If you want to use special font settings, I think that cannot be done using Formula language. Here's an alternative solution: use 2 fields (or computed texts) that display the same information, one set to black and the other to red, and use a hide-when formula to display only one of the fields. This can only be used for ordinary fields, not for rich-text fields.
Avatar of QuinF
QuinF

I would also not include the @Newlines in the @text formula.  You want to make the DateReceived a text value to add it to the rest of the text and the Newlines are basically text already.

@Command([EditInsertText]; "Date of Request:  " +  @Text(DateReceived) +
@NewLine + @NewLine);

Do you want to change the color in a view column or on a form?  If on a form, then sjef is correct.  You would make 2 fields, both fields show the same value but in different colors and hide the one you don't want to use.
@QuinF, about the @Newline inside the @Text: very observant!!
Avatar of DMRyan

ASKER

Thank you!  The code for the date field is now working.  

Changing the font color to red based upon a field value would need to be red when composing a mail message.
I'm not sure I understand.  Can you elaborate a little more?  Maybe explain what you are trying to do.  Pretend we know nothing about your form.
Avatar of DMRyan

ASKER

I have a form with a button on it.  When a user clicks the button it composes and email and populates data from the form into the body of the email.  If the data value of the field "Impact" = High then I want the color of this "High" text to be in the color red instead of black.
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer