<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged gid</title>
<link>https://overflow.efficy.io/?qa=tag/gid</link>
<description>Powered by Question2Answer</description>
<item>
<title>Grid consult : add class depends on value</title>
<link>https://overflow.efficy.io/?qa=3480/grid-consult-add-class-depends-on-value</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I added 3 fields in PROD&lt;em&gt;PROD :&lt;br&gt;
- 2 float with the Designer: F&lt;/em&gt;REAL and F&lt;em&gt;REST&lt;br&gt;
- 1 virtual directly with SQL query in MS SQL Server : V&lt;/em&gt;TOTAL. To insert him, I copied OPPORTUNITIES.ADJBUDGET and updated it :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select * into #tmp from SYS_FIELDS where K_TABLE=22000 and K_FIELD=23 -- OPPORTUNITIES.ADJBUDGET
Update #tmp set K_TABLE=30030, K_FIELD=275, NAME='V_TOTAL', LOOKUPASSOCIATE='=F_REAL+F_REST', ISCUSTOM=1 
select * from #tmp 
insert into  SYS_FIELDS select * from #tmp 
drop table #tmp;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(one question: is it possible to add field like this via the Designer ?)&lt;br&gt;
 I use it the Products Grid on Product Consult view&lt;br&gt;
I want to add a class to the row depending on V&lt;em&gt;TOTAL value :&lt;br&gt;
- V&lt;/em&gt;TOTAL &amp;gt; 0 --&amp;gt; 'text-success'&lt;br&gt;
- V&lt;em&gt;TOTAL = 0 --&amp;gt; 'text-warning'&lt;br&gt;
- V&lt;/em&gt;TOTAL &amp;lt; 0 --&amp;gt; 'text-danger'&lt;/p&gt;

&lt;p&gt;The Grid tag I can just be used as a switch, is there a way to do what I want ?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GridColumnsCustom.txt&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;startrow.Prod {[&amp;lt;tr data-key=&quot;&amp;lt;#F=$KEY$;absent=true;nospace=''&amp;gt;&quot; class=&quot;&amp;lt;#I=ISDELETED;1=deleted;#else=&amp;gt; &amp;lt;#I=V_TOTAL;0=text-warning;&amp;gt;0=text-success;#ELSE=text-danger&amp;gt;&quot;&amp;gt;]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;EDIT :&lt;br&gt;
DetailGridColumns.Prod.Prod&lt;br&gt;
&lt;img src=&quot;https://overflow.efficy.com/?qa=blob&amp;amp;qa_blobid=6354817936665060548&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MacroConsultCustom.txt&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DetailGridColumns.Prod.Prod {[MENU,NAME,REFERENCE,R_FAMILY,F_REAL,F_REST,V_TOTAL]}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3480/grid-consult-add-class-depends-on-value</guid>
<pubDate>Tue, 21 Aug 2018 12:31:34 +0000</pubDate>
</item>
</channel>
</rss>