0

Styled Text Formula Help Please

I have this formula and I want line 2 to have a yellow background. What do I need to add to the formula?

if 'Will Sell Individually' then
"I will split this set and sell individually. Ask me for pricing."
else
"Price is for all items shown in the main (largest) photo"
end

 

I can make a simple formula like work, but I have not been able to successfully incorporate that into my if/then formula shown above.

styled("my Text", "yellow")

7 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

    if 'Will Sell Individually' then
    styled("I will split this set and sell individually. Ask me for pricing.","white")
    else
    styled("Price is for all items shown in the main (largest) photo","yellow")
    end

    • Mr_K
    • 3 yrs ago
    • Reported - view

    @RoSoft_Steven Rooryck, I can make that formula work in my record window, but not in my print layout window, and that is where I need it to work. Any suggestions?

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

    This seems not to be possible. I tried with html styling in a formula field in the printeditor but once printing out, the field is no more styled.

    Code I used:

    if 'Will Sell Individually' then
    html(---
    <p style="background-color:white;">I will split this set and sell individually. Ask me for pricing.</p>
    ---)
    else
    html(---
    <p style="background-color:yellow;">Price is for all items shown in the main (largest) photo</p>
    ---)
    end

    (It shows correct in the printeditor though)

    However, if this is on record level, only one record is printed out / article, you could use two print layouts where you style one text and on the other print not.

    With a button to print, you can chose one or the other printlayout depending on the field 'Will Sell Individually'

    Hope the printeditor will be updated soon so we don't need such hacks annymore.

    Maybe anyone else any ideas?

    Steven.

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

    Important update/edit:

    The html formula does seems to work on the printed pdf when used on Ipad version. (I'll test it later on MAC-version) Seems like the print-engine is different on native versions.

    One downside of using the formula, you can't edit it annymore afterwards. You need to delete it and re-enter it in a formula field. (Having a backup somewhere of the used code would be handy if you need to change something)

    Steven.

    • Mr_K
    • 3 yrs ago
    • Reported - view

    I can't make it work on the Mac app.

    • Nick
    • 3 yrs ago
    • Reported - view

    Steven's html code works for me on the Mac app.

    • Mr_K
    • 3 yrs ago
    • Reported - view

    I stand corrcted. It does work, but as RoSoft_Steven Rooryck pointed out it can't be edited, and I find it can't be centered. It's a neat solution, but very difficult to use in practice.

Content aside

  • 3 yrs agoLast active
  • 7Replies
  • 823Views