Hello Experts I have a scenario where I upload a file and read key value pairs from that uploaded file. Now, if the key value pair is present in the file, I display them in Text box. And if not present I display that particular value is not present in the file. So, My question is can we display text in different colors on basis if the key value is present and not present in the file. for example : if key value is present display it in text area in black color. And if value is not present display the text “not present” in red color.
If you want to show the key value in black and the text “Key is not present” You have two scenarios.
use the dynamic styling as suggested but check on string value instead of empty
$currentObject/Value = ‘Key is not present’
If no key is returned keep the value of the key empty and use two text widgets with conditional visibility
On widget displaying the key when present use this condition
Add an 2nd text widget with text Key is not present, class; text-danger. Conditional visibility $currentObject/Value = empty
ps. to achieve this no custom JAVA is needed. So if you do magic in JAVA to get this behavior, please get rid of it. If you use JAVA to obtain the key somewhere, then go ahead (but check if you can use the out of the box integration options!)
Rene van Hofwegen
You can achieve this with dynamic classes on the text widget.
Widget properties > Appearance > Dynamic classes
Add an expression something like this;
$currentObject/Value = empty