<?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 — Динамическое обновление Table Grid]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=7173</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=7173&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Динамическое обновление Table Grid.]]></description>
		<lastBuildDate>Sat, 09 Jan 2021 21:14:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39696#p39696</link>
			<description><![CDATA[<p>Time is an existing method! Try changing time to <strong>myTime</strong> for example.</p><p>Here is my code that works:</p><div class="codebox"><pre><code>var
Timer : TTimer;
iSeconds : integer;


procedure frmMain_On_Show(Sender: TObject; Action string);
begin

     Timer := TTimer.Create (frmMain);
     Timer.Interval := 20000;  //Reset every 20 seconds
     Timer.Enabled := True;
     Timer.OnTimer := @OnTimer;
end;

procedure OnTimer;
begin

     iSeconds := iSeconds + 1;
     frmMain.lbCounter.Caption := &#039; &#039;+intToStr(iSeconds);
     AutocloseSet;
     if iSeconds &gt; 30 then // This equals 10 minutes approx
     begin
         
          dbUpdateTimer;
          iSeconds := 0;
     end;
end;

procedure dbUpdateTimer;
var
    indx,cnt : integer;
begin

 {update all tables on main form
  cnt := frmMain.ComponentCount -1;
  for indx := 0 to cnt do
  begin
    if frmMain.Components[indx]  is TdbStringGridEx then
        TdbStringGridEx(frmMain.Components[indx]).dbUpdate;
  end; 
 
 {update tables on all other forms}                                                                                           
  frmOrderEntry.grdOrder.dbUpdate;
  frmEditAssemblies.tgMasterPart.dbUpdate;
  frmEditAssemblies.tgSubPart.dbUpdate;
  frmEditPart.grdEditPart.dbUpdate;
  
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Sat, 09 Jan 2021 21:14:44 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39696#p39696</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39695#p39695</link>
			<description><![CDATA[<p>Разобрался!<br />Нужно было присвоить компонентам События</p>]]></description>
			<author><![CDATA[null@example.com (cscnewm)]]></author>
			<pubDate>Sat, 09 Jan 2021 19:58:43 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39695#p39695</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39688#p39688</link>
			<description><![CDATA[<p>Доброго времени суток.<br />Подскажите по поводу обновления таблицы.</p><p>var<br />time:TTimer;</p><p>procedure Form1_OnShow (Sender: TObject; Action: string);<br />begin<br />&nbsp; &nbsp; time:=TTimer.Create(Form1);<br />&nbsp; &nbsp; time.Interval:=200;<br />&nbsp; &nbsp; time.Enabled:=True;<br />&nbsp; &nbsp; time.OnTimer:=@updateGrid;<br />end;<br />procedure updateGrid ;<br />begin<br />Form1.TableGrid1.dbUpdate;<br />end;</p><p>Не работает скрипт<br />Что не так?</p>]]></description>
			<author><![CDATA[null@example.com (cscnewm)]]></author>
			<pubDate>Sat, 09 Jan 2021 13:41:34 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39688#p39688</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39480#p39480</link>
			<description><![CDATA[<div class="quotebox"><cite>muserun wrote:</cite><blockquote><p>Пока никак.</p></blockquote></div><p>Добавьте поле &quot;Дата/время создания записи&quot;. Храните в программе дату/время последней проверки, которую вы делаете по таймеру. А в самой проверке запросом определяйте количество новых записей - это те записи, у которых дата создания больше, чем дата последней проверки.</p><br /><p>Если новые записи есть, то вы обновляете основную таблицу данных и выдаёте звуковой сигнал. При желании с помощью скрипта новые записи можно выделить цветом.</p>]]></description>
			<author><![CDATA[null@example.com (k245)]]></author>
			<pubDate>Mon, 21 Dec 2020 05:37:18 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39480#p39480</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39371#p39371</link>
			<description><![CDATA[<p>Спасибо</p>]]></description>
			<author><![CDATA[null@example.com (muserun)]]></author>
			<pubDate>Sun, 13 Dec 2020 13:44:38 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39371#p39371</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39370#p39370</link>
			<description><![CDATA[<div class="quotebox"><cite>muserun wrote:</cite><blockquote><p>Может у кого есть пример?</p></blockquote></div><p>вот пример (свободные и принятые заявки) с двумя таблицами используется скрип</p>]]></description>
			<author><![CDATA[null@example.com (sibprogsistem)]]></author>
			<pubDate>Sun, 13 Dec 2020 13:24:46 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39370#p39370</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39368#p39368</link>
			<description><![CDATA[<p>Может у кого есть пример?</p>]]></description>
			<author><![CDATA[null@example.com (muserun)]]></author>
			<pubDate>Sun, 13 Dec 2020 12:46:35 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39368#p39368</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39343#p39343</link>
			<description><![CDATA[<p>Я просто с Ваших слов уже понял. И Вы подсказали правильную логику. Т.Е. если исполнитель забирает себе задачу, то она должна уже открываться в другом гриде В РАБОТЕ.</p>]]></description>
			<author><![CDATA[null@example.com (muserun)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:59:20 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39343#p39343</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39341#p39341</link>
			<description><![CDATA[<div class="quotebox"><cite>muserun wrote:</cite><blockquote><p>Если честно не понятно</p></blockquote></div><p>я так понимаю Вы хотите сделать два грида</p>]]></description>
			<author><![CDATA[null@example.com (sibprogsistem)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:55:45 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39341#p39341</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39340#p39340</link>
			<description><![CDATA[<p>Если честно не понятно</p>]]></description>
			<author><![CDATA[null@example.com (muserun)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:53:14 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39340#p39340</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39339#p39339</link>
			<description><![CDATA[<div class="quotebox"><cite>muserun wrote:</cite><blockquote><p>Вы правы. Можно я подробнее. Есть форма где выводятся заказы на обработку текстов. Задача формы формировать новые заказы для показа исполнителю. Тут Вы мне удачно подсказали.Я могу к примеру поставить Да-Нет в базу и при формировании новой записи этот чекбокс будет свободен. и тогда выше то о чем писали.Чекбокс свободен,новая запись-ЗВУКНо к примеру если исполнитель берет заказ,то ставит просто галку и тогда... Тут опять тогда нужно перенсти эту запись в новый TableGrid. Я так понимаю?</p></blockquote></div><p>запись нужно просто обновить можно сделать это с помощью скрипта<br /></p><div class="codebox"><pre><code>SQLExecute(&#039;UPDATE таблица SET поле=&quot;1&quot; WHERE id=&#039;+переменная с номером id);</code></pre></div><p>либо использовать форму просмотра записи с действием (показать запись) если&nbsp; в такой форме создать изменения и сохранить, то запись обновиться..</p>]]></description>
			<author><![CDATA[null@example.com (sibprogsistem)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:51:12 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39339#p39339</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39338#p39338</link>
			<description><![CDATA[<p>Вы правы. Можно я подробнее. Есть форма где выводятся заказы на обработку текстов. Задача формы формировать новые заказы для показа исполнителю. Тут Вы мне удачно подсказали.Я могу к примеру поставить Да-Нет в базу и при формировании новой записи этот чекбокс будет свободен. и тогда выше то о чем писали.Чекбокс свободен,новая запись-ЗВУКНо к примеру если исполнитель берет заказ,то ставит просто галку и тогда... Тут опять тогда нужно перенсти эту запись в новый TableGrid. Я так понимаю?</p>]]></description>
			<author><![CDATA[null@example.com (muserun)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:39:24 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39338#p39338</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39337#p39337</link>
			<description><![CDATA[<p>полный скрипт мне все равно ни чего не скажет.<br />Вам нужно определиться как будет отмечаться новая запись в БД и для чего это нужно....<br />к примеру новая запись полем да/нет&nbsp; пользователь получает сообщение при проверке переходит к записи и поле переводится в НЕТ, а для других пользователей становится не доступной..</p>]]></description>
			<author><![CDATA[null@example.com (sibprogsistem)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:32:24 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39337#p39337</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39336#p39336</link>
			<description><![CDATA[<p>Пока никак.<br /></p><div class="codebox"><pre><code>procedure frmAdministrator_tblGeneralWork_OnChange (Sender: TObject);
begin

end;

procedure frmAdministrator_OnShow (Sender: TObject; Action: string);
var
 time:TTimer;
begin
  begin
    time:=TTimer.Create(frmAdministrator);
    time.Interval:=20000;
    time.Enabled:=True;
    time.OnTimer:=@updateGrid;
  end;

end;
procedure updateGrid ; 
  begin
    frmAdministrator.tblGeneralWork.dbUpdate;
  end;


procedure frmAutch_OnShow (Sender: TObject; Action: string);
  var
  sUSN: string = &#039;1&#039;;

begin
  begin
    {$MySQL disable_connectdialog}
     Application.ProcessMessages;


     frmAutch.MySQLConnection.Server := &#039;IP&#039;;
     frmAutch.MySQLConnection.Port := 3306;
     frmAutch.MySQLConnection.Username := &#039;user_user&#039;;
     frmAutch.MySQLConnection.Password := &#039;Password&#039;;
     frmAutch.MySQLConnection.Database := &#039;db_user&#039;;

     try
         frmAutch.MySQLConnection.Connect;
       except
             //frmWait.Close;
             ShowMessage(&#039;Не могу подключиться к базе данных. Проверьте пожалйста интернет соединение!!!&#039;);
             frmAutch.Close;
     end;

     if frmAutch.MySQLConnection.Connected then
         begin
             UpdateDatabase(&#039;&#039;); // to fill ComboBoxes
             //frmAutch.TableGrid1.dbUpdate; // if you have TableGrid on first form with option &quot;Enable auto execution&quot;, you should call method dbUpdate manually
         end;
         //frmWait.Close;

end;
                                                       
    frmAutch.mniAbout.OnClick := @MenuClickAbout;


// ---------------------------- Первичные записи в базу данных  ------------------------------------


   // проверка наличия прав пользователей
  // если нет, то создать права пользователей
     //if SQLExecute(&#039;SELECT count(id) FROM userStatus;&#039;) = &#039;0&#039; then
     //begin
      //   SQLExecute(&#039;INSERT INTO userStatus (userStatusName) VALUES (&quot;Директор&quot;);&#039;);
       //  SQLExecute(&#039;INSERT INTO userStatus (userStatusName) VALUES (&quot;Офис1&quot;);&#039;);
      //   SQLExecute(&#039;INSERT INTO userStatus (userStatusName) VALUES (&quot;Офис2&quot;);&#039;);
       //  SQLExecute(&#039;INSERT INTO userStatus (userStatusName) VALUES (&quot;Офис3&quot;);&#039;);
     //end;
     //UpdateDatabase(&#039;userStatus&#039;);

  // проверка наличия администратора базы данных
  // если нет, то создать первичного пользователя логин demo пароль demo
    //if SQLExecute(&#039;SELECT count(id) FROM users;&#039;) = &#039;0&#039; then
    //begin
      //  SQLExecute(&#039;INSERT INTO users (id_userStatus, login, password) VALUES (&quot;&#039;+sUSN+&#039;&quot;, &quot;demo&quot;, &quot;demo&quot;);&#039;);
     //end;
     //UpdateDatabase(&#039;users&#039;);


end;


procedure frmAutch_btnAutch_OnClick (Sender: TObject; var Cancel: boolean);
 var
  s,t,r: string;
  sStatus: string;
begin

    // Запрос SQL для проверки пользователя и пароля
     s := VarToStr(SQLExecute(&#039;SELECT count(id) FROM users WHERE (id = &#039; + IntToStr(frmAutch.cmbLogin.dbItemID) + &#039;) AND (password = &#039;&#039;&#039; + frmAutch.edPassword.Text + &#039;&#039;&#039;);&#039;));
          // если SQL-запрос нашел логин и пароль
        if (s&lt;&gt;&#039;0&#039;) AND (s&lt;&gt;&#039;&#039;) then
          begin                                                          
             //скрыть форму авторизации
             frmAutch.Hide;
             // SQL-запрос прав пользователя
             sStatus := SQLExecute(&#039;SELECT id_userStatus FROM users WHERE id=&#039;+IntToStr(frmAutch.cmbLogin.dbItemID));
             // если права пользователя * то открыть *
             if sStatus = &#039;1&#039; then frmAdministrator.Show else  //администратор
             if sStatus = &#039;2&#039; then frmOffice1.Show else
             if sStatus = &#039;3&#039; then frmOffice2.Show else
             if sStatus = &#039;4&#039; then frmOffice3.Show ;
     end else MessageBox(&#039;Пароль неверен&#039;,&#039;Ошибка подключения &#039;, MB_OK+MB_ICONSTOP);
end;


procedure MenuClickAbout (Sender: string); // click in About menu item
begin
     frmAbout.ShowModal;
end;

begin
     frmAutch.mniFile.Visible := True;
     frmAutch.mniOptions.Visible := False;
     frmAutch.mniSettings.Visible := False;
     frmAutch.mniReport.Visible := False;
     frmAutch.mniAbout.Visible := True;
end.

procedure frmAbout_lblSite_OnClick (Sender: TObject);
begin
   OpenUrl(&#039;https://&#039;);
end;

begin

end.</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (muserun)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:24:37 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39336#p39336</guid>
		</item>
		<item>
			<title><![CDATA[Re: Динамическое обновление Table Grid]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=39335#p39335</link>
			<description><![CDATA[<div class="quotebox"><cite>muserun wrote:</cite><blockquote><p>Все это прекрасно,но как сделать это ТОЛЬКО при возникновении события НОВАЯ ЗАПИСЬ В БАЗЕ ДАННЫХ Table Grid</p></blockquote></div><p>для начала нужно написать проверку новой записи<br />как у Вас определяется новая запись?</p>]]></description>
			<author><![CDATA[null@example.com (sibprogsistem)]]></author>
			<pubDate>Sat, 12 Dec 2020 07:21:17 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=39335#p39335</guid>
		</item>
	</channel>
</rss>
