0

Styling a portion of a formula

I have tried this without success so far.  Is there a way to Style  'Files' only bit  in this formula.  Files is a formula given the number of attachments for this record.

The Files formula is:  cnt(files(this))

Formula I am trying to Styl only Files (field)

 

styled(" Attached Files: " + Files, " ", " ", " ") + " ➡️  " + BUILDING.'BUILDING NAME' + " " + 'ROOM NUMBER/LOCATION' + " " + BUILDING.'BUILDING LOCATION'

10 replies

null
    • Alan_Cooke
    • 1 yr ago
    • Reported - view

    I am aware that the "" contain nothing here - I want to colour RED but have been unable to so far.

    • Fred
    • 1 yr ago
    • Reported - view

    I’m guessing using HTML you can. But one of our HTML wizards would have to respond.

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

       Alan Cooke Like Fred said, you could use html with CSS styling to do so:

      html("<div> Attached files: <span style='background-color:red;color:white;'> " + Files + "</span> ➡️" + BUILDING.'BUILDING NAME' + " " + 'ROOM NUMBER/LOCATION' + " " + BUILDING.'BUILDING LOCATION' + "</div>")

      (I hope I didn't forget any double quotes here)

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Worked a charm with a small tweak to get '0' red

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Hi:  I am trying to use this neat styling to tweak other 'banner' formulae.  I cannot get this one to work - can you assist please?

      if PROTOCOL then
          'SELECT BUILDING, ROOM & DESCRIPTION'.BUILDING.'BUILDING NAME' + " " + 'ROOM NUMBER' + " - " + 'SELECT MANUFACTURER/SUPPLIER'.MANUFACTURER + " " + MODEL + html("<div> <span style='background-color:;color:red;'> + [" + PROTOCOL + "]</span></div>")

      I want the [ PROTOCOL] all in red.  As it is now there is no change in color.

    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view

    maybe change this in your last line code:
    html("<div> <span style='color:red;'>[" + text(PROTOCOL) + "]</span></div>")

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      RoSoft_Steven After a good 20 minutes I got it!

      html("<div> <span style='background-color:;color:green;'> PROTOCOL: " + PROTOCOL + "</span> ➡️" + 'SELECT BUILDING, ROOM & DESCRIPTION'.BUILDING.'BUILDING NAME' + " " + 'ROOM NUMBER' + " - " + 'SELECT MANUFACTURER/SUPPLIER'.MANUFACTURER + " " + MODEL + "</div>").

      However I now have this issue when using an if/then when no Protocol is set.  I tried it the other way around if Protocol vs if Not.... same issue.  Can you figure out the issue?

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      Alan Cooke Figured it out!!

      So for anyone here wanting to use HTML to style here is a chain of posts that lead to a solution

      if PROTOCOL then
          html("<div> <span style='background-color:;color:green;'> PROTOCOL: " + PROTOCOL + "</span> ➡️" + 'SELECT BUILDING, ROOM & DESCRIPTION'.BUILDING.'BUILDING NAME' + " " + 'ROOM NUMBER' + " - " + 'SELECT MANUFACTURER/SUPPLIER'.MANUFACTURER + " " + MODEL + "</div>")
      else
          html("<div> <span style='background-color:;color:;'> </span> " + 'SELECT BUILDING, ROOM & DESCRIPTION'.BUILDING.'BUILDING NAME' + " " + 'ROOM NUMBER' + " - " + 'SELECT MANUFACTURER/SUPPLIER'.MANUFACTURER + " " + MODEL + "</div>")
      end

      • Fred
      • 1 yr ago
      • Reported - view

      Alan Cooke 👍🏽 

      Ninox does not like if statements with two different type of responses. The “then” was a text response and the “else” was html. You fixed it by making both html. 

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      Fred I figured that could be the reason hence my mod.

Content aside

  • 1 yr agoLast active
  • 10Replies
  • 186Views
  • 3 Following