<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — Example of condition color]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=7049</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=7049&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Example of condition color.]]></description>
		<lastBuildDate>Tue, 16 Feb 2021 14:28:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40141#p40141</link>
			<description><![CDATA[<div class="quotebox"><cite>derek wrote:</cite><blockquote><p>Hi,<br />I&#039;ve added the status as a filter.<br />However, I&#039;ve done this as a combobox and not as a separate button for each status because:<br />1.&nbsp; It would take up a lot more room so would need a redesign of the form.<br />2.&nbsp; It&#039;s probably better that your application has a consistency of filter type - I don&#039;t think it helps users to have a mix of filter types (sometimes a button, sometimes a combobox etc) if it can possibly be avoided.<br />Derek.</p></blockquote></div><p>Thank youuuu!!!!!!!!!!!!!!</p>]]></description>
			<author><![CDATA[null@example.com (gonpublic2k)]]></author>
			<pubDate>Tue, 16 Feb 2021 14:28:56 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40141#p40141</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40137#p40137</link>
			<description><![CDATA[<p>Hi,<br />I&#039;ve added the status as a filter.<br />However, I&#039;ve done this as a combobox and not as a separate button for each status because:<br />1.&nbsp; It would take up a lot more room so would need a redesign of the form.<br />2.&nbsp; It&#039;s probably better that your application has a consistency of filter type - I don&#039;t think it helps users to have a mix of filter types (sometimes a button, sometimes a combobox etc) if it can possibly be avoided.<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Tue, 16 Feb 2021 12:52:16 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40137#p40137</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40129#p40129</link>
			<description><![CDATA[<div class="quotebox"><cite>derek wrote:</cite><blockquote><p>Hi,<br />Try it like this (see attached).<br />Regards,<br />Derek.</p></blockquote></div><p>Very nice Derek, only one thing - what if I wanted to show by using a button for each state I guess, all completed, in progress and waiting?<br />just like the example you gave above that showed all items out of stock, low stock etc..</p><p>I just don&#039;t know how to get it done with the combobox part.&nbsp; Thanks!!!</p>]]></description>
			<author><![CDATA[null@example.com (gonpublic2k)]]></author>
			<pubDate>Tue, 16 Feb 2021 00:23:51 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40129#p40129</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40128#p40128</link>
			<description><![CDATA[<p>Hi,<br />Try it like this (see attached).<br />Regards,<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Tue, 16 Feb 2021 00:00:33 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40128#p40128</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=40124#p40124</link>
			<description><![CDATA[<div class="quotebox"><cite>derek wrote:</cite><blockquote><p>Hi Popcornelnicusor, CDB.&nbsp; Salut Jean,<br />Hope you&#039;re all keeping well.<br />Another option (no script needed) is to use a calculated field to hold a &#039;stock status&#039; flag (please see attachment &#039;conditional grid 1&#039;) which also gives the ability to sort and filter by &#039;stock status&#039; which might be of use.<br />Or you could combine it with Jean and CDB&#039;s suggestions and colour the&nbsp; &#039;stock status&#039; flag (please see attachment &#039;conditional grid 2&#039;).<br />Regards,<br />Derek.</p></blockquote></div><p>Hello Derek, quick question about this - can this be adopted to the table grid on the report project you helped me out with the other day?&nbsp; Have the different states to show a color on the grid, example :&nbsp; green for COMPLETED, yellow for IN PROGRESS and red for WAITING?</p><p>Let me know how this can be implemented, please!!!</p>]]></description>
			<author><![CDATA[null@example.com (gonpublic2k)]]></author>
			<pubDate>Mon, 15 Feb 2021 21:40:04 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=40124#p40124</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38583#p38583</link>
			<description><![CDATA[<p>Dear all,just what i needed thank you all</p>]]></description>
			<author><![CDATA[null@example.com (popcornelnicusor)]]></author>
			<pubDate>Sun, 18 Oct 2020 15:47:12 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38583#p38583</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38572#p38572</link>
			<description><![CDATA[<p>Hi Popcornelnicusor, CDB.&nbsp; Salut Jean,<br />Hope you&#039;re all keeping well.<br />Another option (no script needed) is to use a calculated field to hold a &#039;stock status&#039; flag (please see attachment &#039;conditional grid 1&#039;) which also gives the ability to sort and filter by &#039;stock status&#039; which might be of use.<br />Or you could combine it with Jean and CDB&#039;s suggestions and colour the&nbsp; &#039;stock status&#039; flag (please see attachment &#039;conditional grid 2&#039;).<br />Regards,<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Sat, 17 Oct 2020 14:22:50 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38572#p38572</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38571#p38571</link>
			<description><![CDATA[<p>I can offer you this, the rows change colour depending on criteria - basically just another way of doing what JB has written above.&nbsp; &nbsp;If your code can use a SELECT statement you&#039;d be able to make the code below more compact.</p><br /><div class="codebox"><pre><code>procedure frmMain_tgOrders_OnChange (Sender: TObject);
CONST
    DATE_ORD = 5; DATE_PO = 7; DATE_REQ = 8; ORD_QTY = 9; ORDER_REC = 10; DUE = 11;
var
row, column, rowcnt, colcnt: integer;
begin

   rowcnt := frmMain.tgOrders.RowCount -1;
   colcnt := frmMain.tgOrders.Columns.Count -1;

   for row := 0 to rowcnt do
   begin
       if frmMain.tgOrders.Cells[DUE,row] = &#039;0&#039; then     //Complete order received colour red/pink
       begin
           for column := 0 to colcnt do
           begin
               frmMain.tgOrders.Cell[column,row].Color := $00BDA8FD;
           end;
      end
      else
    
      {Part order received   colour Blue}
          if (frmMain.tgOrders.Cells[DUE,row] &lt; frmMain.tgOrders.Cells[ORD_QTY,row])    then     //Complete order recieved
           begin
               for column := 0 to colcnt do
               begin                                       //light blue
                   frmMain.tgOrders.Cell[column,row].Color :=$00FFFFA8; // interesting brown $0065AACD;
               end;
          end     
      else
     

        {Quote pending colour green}
          if (frmMain.tgOrders.Cells[DATE_REQ,row] &lt;&gt; &#039;&#039;) AND (frmMain.tgOrders.Cells[DATE_PO,row] =&#039;&#039;) then
           begin
               for column := 0 to colcnt do
               begin                                          //light green
                   frmMain.tgOrders.Cell[column,row].Color := $00B4F2B6;
               end;
          end    
      else   

    {To be ordered colour yellow}
    if  ((frmMain.tgOrders.Cells[DATE_ORD,row] = &#039;&#039;)AND (frmMain.tgOrders.Cells[DATE_PO,row] =&#039;&#039;) AND (frmMain.tgOrders.Cells[DATE_REQ,row]= &#039;&#039;)) then
       begin
           for column := 0 to colcnt do
           begin                                          //light yellow
               frmMain.tgOrders.Cell[column,row].Color := $0080FFFF;
           end;
      end;

   end;
 
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Sat, 17 Oct 2020 07:55:41 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38571#p38571</guid>
		</item>
		<item>
			<title><![CDATA[Re: Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38570#p38570</link>
			<description><![CDATA[<p>Hello popcornInicusor</p><p>You could adapt thoses siippets to your projets.</p><p>procedure Form1_TableGrid1_OnChange (Sender: string);<br />var&nbsp; &nbsp; &nbsp;i,c: integer;<br />begin<br />&nbsp; &nbsp; c := Form1.TableGrid1.RowCount - 1;<br />&nbsp; &nbsp; for i := 0 to c do<br />&nbsp; &nbsp; begin<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if Form1.TableGrid1.Cells[3,i] = &#039;Yes&#039; then Form1.TableGrid1.Cell[3,i].Color := clRed;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if Form1.TableGrid1.Cells[3,i] = &#039;No&#039; then Form1.TableGrid1.Cell[3,i].Color := clGreen;<br />&nbsp; &nbsp; end;<br />end;</p><p>Same ways with dates (&lt; Date and Date + 1) :</p><p>procedure Form1_TableGrid1_OnChange (Sender: TObject);<br />var<br />&nbsp; &nbsp;i,c: integer;<br />begin<br />&nbsp; &nbsp;Form1.TableGrid1.BeginUpdate;<br />&nbsp; &nbsp;c := Form1.TableGrid1.RowCount - 1;<br />&nbsp; &nbsp;for i := 0 to c do<br />&nbsp; &nbsp;begin<br />&nbsp; &nbsp; &nbsp; if StrToDateTime(Form1.TableGrid1.Cells[4,i]) &lt; Date then Form1.TableGrid1.Cell[4,i].Color := $00FF80FF;<br />&nbsp; &nbsp; &nbsp; if StrToDateTime(Form1.TableGrid1.Cells[4,i]) = Date+1&nbsp; then Form1.TableGrid1.Cell[4,i].Color := clGreen;<br />&nbsp; &nbsp;end;<br />&nbsp; &nbsp;Form1.TableGrid1.EndUpdate;<br />end;</p><p>JB</p>]]></description>
			<author><![CDATA[null@example.com (jean.brezhonek)]]></author>
			<pubDate>Sat, 17 Oct 2020 06:18:36 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38570#p38570</guid>
		</item>
		<item>
			<title><![CDATA[Example of condition color]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=38569#p38569</link>
			<description><![CDATA[<p>Hi MVD team, it&#039;s possible to add like a minimul stock and in the table grid to show colors?</p><p>if tis reach a number seted te be red<br />if it biger than the number above to be green<br />and if it&#039;s equal to the number t be yellow</p>]]></description>
			<author><![CDATA[null@example.com (popcornelnicusor)]]></author>
			<pubDate>Sat, 17 Oct 2020 06:08:20 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=38569#p38569</guid>
		</item>
	</channel>
</rss>
