Discussions

Expand all | Collapse all

Colorized List Formula

The Cobra03-07-2017 22:12

Gaurav Sharma03-08-2017 04:48

QuickBaseCoach Dev./Training12-06-2017 18:35

  • 1.  Colorized List Formula

    Posted 03-07-2017 18:10
    I currently have a text formula that creates a list that looks like this:
    List("\n",ToText( [Field 1])&" "&"Width",
    ToText([Field 2])&" "&"Length",
    ToText([Field 3])&" "&"Depth")

    I want this list to be colorized so i created a formula like so:
    "<span style=\"color:red;font-weight:bold;\">"&  [Colored List]&"</span>"

    But when It displays it doesn't display as a list, it simply displays everything in one line.

    What am i doing wrong? Thank you.


  • 2.  RE: Colorized List Formula

    Top
    Contributor
    Posted 03-07-2017 18:15
    I believe you need to 'style' each individual item WITHIN the list function.

    however, I'm sure you will have to style things differently in total to get that affect.


  • 3.  RE: Colorized List Formula

    Silver
    Contributor
    Posted 03-07-2017 18:22

    You will need to embed your html into the list code:

    List ("\n","<span style='color:red;font-weight:bold;'>"ToText([Field 2])&"</span>"...




  • 4.  RE: Colorized List Formula

    Posted 03-07-2017 19:12
    Thank you. I tried it and it still doesn't list the items. Displays a single line. What could i be doing wrong?

    List("\n","<span style=\"color:red;font-weight:bold;\">"&  ToText([Width])&"</span>",
    "<span style=\"color:green;font-weight:bold;\">"&  ToText([Length])&"</span>",
    "<span style=\"color:blue;font-weight:bold;\">"&  ToText([Depth])&"</span>")


  • 5.  RE: Colorized List Formula

    Silver
    Contributor
    Posted 03-07-2017 19:19
    Let's try the "\n" at the end of each item. ...&"</span>"&"\n"&


  • 6.  RE: Colorized List Formula

    Posted 03-07-2017 19:42
    The \n is a newline character, which works for regular formulas. Once you check the "allow some HTML" you now need to use the HTML new line character. I just tested in a dummy app to confirm this works:
    "<span style=\"color:red;font-weight:bold;\">" & List("<br />",[Field1] & " Width",[Field2] & " Length",[Field3] & " Depth") & "</span>


  • 7.  RE: Colorized List Formula

    Posted 03-07-2017 22:12
    Works perfectly! thank you!


  • 8.  RE: Colorized List Formula

    Silver
    Contributor
    Posted 03-08-2017 04:48
    nice.. It works :)


  • 9.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-06-2017 18:34
    What if I don't want a field to show unless there's a selection made?


  • 10.  RE: Colorized List Formula

    Posted 12-06-2017 18:35
    If you post your code we can adjust it.


  • 11.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-06-2017 18:42
    Ok, I'm just starting to build it, but it's used on multiple forms, so there are times when I don't want some selections to appear. Here is what I have so far, and it's working:

    "<span style=\"color:red;font-weight:bold;\">" & List("<br />"," Final Determination: "&[Pass/Fail],"Reason: "&[Reason for Determination],"Inspector: "&[Inspector]) & "</span>


  • 12.  RE: Colorized List Formula

    Posted 12-06-2017 18:44
    No problem, just wrap it with an IF statement


    IF([ some field is not blank ] ...., 

    "<span style=\"color:red;font-weight:bold;\">" & List("<br />"," Final Determination: "&[Pass/Fail],"Reason: "&[Reason for Determination],"Inspector: "&[Inspector]) & "</span>"

    )


  • 13.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-06-2017 18:47
    Can you use the code I provided for the example? I'm not sure what you mean. Every field should be wrapped in an if statement, or wrap the whole thing?
    Thank you!


  • 14.  RE: Colorized List Formula

    Posted 12-06-2017 19:06
    Just one IF to wrap the whole thing, but you need to define the conditions where you do want the button to show.


  • 15.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-06-2017 19:27
    Button? There's no button. I'm just trying to create a dynamic list that consolidate information from different forms from the same table. If I only use one 'IF', then is it only going to respond to the first rule that is true? I want every field where data has been entered to display. Here is the code:

    List("<br />",
    "Request: "&[Request],
    "Description: "&[Customer Selection],
    "Dealer AA#: "&[Dealer Auction Access ID],
    "Rep AA#: "&[Rep Auction Access ID],
    "Gov't ID (Last 4): "&[Last 4 of SS#],
    "Question: "&[Type of Sales Inquiry],
    "Report Requested: "&[Report Type],
    "Transport Type: "&[Transportation Services],
    "# of Vehicles: "&[Number of Vehicles],
    "Purpose: "&[Purpose],
    "Sale Date: "&[Sale Date to Run],
    "Requests: "&[Special Instructions],
    "Recon: "&[Recon Services],
    "VIN(s): "&[VINs (Last 6)],
    "Recent Note: "&[Recent Note],
    "Purchased: "&[Purchased],
    "Vehicle: "&[Vehicle Details],
    "Claim: "&[Claim],
    "Major Component: "&[Major Components],
    "Vehicle History Issue: "&[Vehicle History Issues],
    "Other Issue: "&[Other Issues],
    "Final Determination: " &"<span style=\"color:red;font-weight:bold;\">"&[Pass/Fail] & "</span>",
    "Add Title: "&[Reason for Determination],
    "Add Title: "&[Inspector])


  • 16.  RE: Colorized List Formula

    Posted 12-06-2017 19:38
    try this



    List("<br />",
    IF(Trim([Request])<>"", "Request: "&[Request],
    IF(Trim([Customer Selection])<>'', "Description: "&[Customer Selection],
    IF(Trim([Dealer Auction Access ID]<>"", "Dealer AA#: "&[Dealer Auction Access ID],

    etc


  • 17.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-06-2017 20:01
    You are brilliant! The only modifications I needed to make were to add a closing parenthesis at the end of each line, and then I had to add the prefix 'ToText' for my numbers fields. As always, thank you so much!!!


  • 18.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-10-2017 16:11
    One more question... On the Pass/Fail field (3rd one up from the bottom), I would like the text to appear in red if it�s �fail�, and green if it�s �pass�. Any suggestions?


  • 19.  RE: Colorized List Formula

    Posted 12-10-2017 16:28
    No problem, just replace your one line with these two lines.  One of them will be null so it will not appear.

    IF([Pass/Fail] = "Pass"
    "Final Determination: " &"<span style=\"color:green;font-weight:bold;\">"&[Pass/Fail] & "</span>"),

    IF([Pass/Fail] = "Fail"
    "Final Determination: " &"<span style=\"color:red;font-weight:bold;\">"&[Pass/Fail] & "</span>"),


  • 20.  RE: Colorized List Formula

    Posted 12-10-2017 16:33
    It can also be simplified like this: "Final Determination: <span style=\"color:" & Case([Pass/Fail],"Pass","green","Fail","red") & ";font-weight:bold;\">" & [Pass/Fail] & "</span>


  • 21.  RE: Colorized List Formula

    Bronze
    Contributor
    Posted 12-10-2017 16:36
    Thank you both. It worked, Coach, but thank you for the additional option, Eric!