Topic Options
#53125 - 03/22/17 12:50 PM Gridview with HTML code as text
L10 Offline
Adagio Enthusiast

Registered: 03/22/17
Posts: 25
Loc: Ontario
Hi Everyone,

I want to add a this formula my gridview:

IF({quantity} >= 1, “<font size="4" color="green">In Stock</font>”, “<font size="4" color="orange">ETA 2-5 days</font>”

Where the result if true will be:
<font size="4" color="green">In Stock</font>

And if false:
<font size="4" color="orange">ETA 2-5 days</font>

However the quotes inside my html code for the true and false responses, break the formula. I need those in there for HTML, is there any way to ignore them?


Thanks
_________________________
Lance Tennier
TDL Canada

Top
#53127 - 03/22/17 01:06 PM Re: Gridview with HTML code as text [Re: L10]
Softrak Support Offline

Adagio Action Team

Registered: 03/09/99
Posts: 11321
Loc: Vancouver, BC Canada
Hi Lance,

Do you want the entire row in the GridView inquiry to have the conditional green/orange colour, or just the quantity column? Both of these can be accomplished without HTML.

For the entire row, create a named Row Format (from the Format menu) that uses a simple IF formula:

IF({quantity} >=1, "In Stock Green Style", "ETA 2-5 Days Orange Style")

where "In Stock Green Style" and "ETA 2-5 Days Orange Style" are named Styles in GridView that you create from the Format / Styles menu, creating font styles for size, colour, etc. Of course they can be named differently than this.

For just the specific quantity column, highlight that column in the grid and select Format / Conditional Styles. Ensure the Enable Conditional Styles checkbox is selected, and enter a similar formula:

IF(#>=1,"In Stock Green Style", "ETA 2-5 Days Orange Style")

where # simply represents the current column (ie the quantity).

Is there a particular reason why you wanted to use HTML?
_________________________
Regards,
Softrak Tech Support

Top
#53128 - 03/22/17 01:11 PM Re: Gridview with HTML code as text [Re: L10]
Retired_Guy Offline
Adagio Master

Registered: 03/16/99
Posts: 10493
Loc: Canada
Use the CHR(34) function for the Quote, like this:
Code:
IF({quantity} >= 1, 
    CONCATENATE(
     "<font size=",
     CHAR(34),
     "4",
     CHAR(34)),
   "FOO")


You need to replace every quote character you need with a call to CHAR(n).
_________________________
Andrew Bates

Top
#53129 - 03/22/17 01:28 PM Re: Gridview with HTML code as text [Re: Retired_Guy]
L10 Offline
Adagio Enthusiast

Registered: 03/22/17
Posts: 25
Loc: Ontario
Yes, it needs to be HTML because this field gets uploaded to our website.

Thanks Andrew, it looks weird, but it works!

This was my final result:

Code:
IF({quantity} >= 1,
CONCATENATE("<font size=",CHAR(34),"4",CHAR(34),"color=",CHAR(34),"green",CHAR(34),">In Stock</font>"),
CONCATENATE("<font size=",CHAR(34),"4",CHAR(34),"color=",CHAR(34),"orange",CHAR(34),">ETA 2-5 Days</font>")
)
_________________________
Lance Tennier
TDL Canada

Top


Moderator:  Christa_Meissner 
Who's Online
0 registered (), 96 Guests and 0 Spiders online.
Key: Admin, Global Mod, Mod
Forum Stats
1848 Members
5 Forums
14239 Topics
69736 Posts

Max Online: 359 @ 11/18/19 09:08 PM
May
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31