<?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 — logged in user and tablegrids & Comboboxes]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=3173</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=3173&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in logged in user and tablegrids & Comboboxes.]]></description>
		<lastBuildDate>Tue, 07 Mar 2017 02:56:58 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19324#p19324</link>
			<description><![CDATA[<p>Thanks for all your help so far. </p><p>I&#039;ll look into the parent combobox - it might be part of the solution.</p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Tue, 07 Mar 2017 02:56:58 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19324#p19324</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19323#p19323</link>
			<description><![CDATA[<p>Hi Timlitw,<br />DBupdate isn&#039;t new in itself but it&#039;s normally used in relation to a tablegrid update.&nbsp; I think dbupdate with a combobox must have been introduced with one of the very latest versions.&nbsp; It&#039;s a pity because it&#039;s a really easy way to filter a combobox.<br />When you say that you&#039;d like to filter in a &#039;smarter way&#039; so that, for example, only products that a trucking company hauls is shown, it sounds very much like the sort of thing that you&#039;d use the parent combobox function for.&nbsp; It might be easier than trying to script it.<br />I meant to mention in my last post - your application continues to run in the background when you quit it;&nbsp; I think it&#039;s because the Form1_Onclose procedure in the script has lost its reference back to the Form1_Onclose event in the object properties.<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Tue, 07 Mar 2017 01:14:20 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19323#p19323</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19322#p19322</link>
			<description><![CDATA[<p>I&#039;m getting there:</p><br /><div class="codebox"><pre><code>CalcShipping.truckCombo.dbSQLExecute(&#039;SELECT TruckCompanies.id, &#039;+
            &#039;TruckCompanies.Name, &#039;+
            &#039;locations.name &#039;+
            &#039;from TruckCompanies &#039;+
            &#039;LEFT OUTER JOIN locations ON TruckCompanies.id_locations = locations.id &#039;+
            &#039;WHERE (locations.name = &#039;&#039;&#039; +sLocation+&#039;&#039;&#039;)&#039;);</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Mon, 06 Mar 2017 18:37:37 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19322#p19322</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19321#p19321</link>
			<description><![CDATA[<p>this is the sql I need - maybe I&#039;m asking for too much data???</p><div class="codebox"><pre><code>SELECT TruckCompanies.id, TruckCompanies.Name, locations.name
from TruckCompanies
LEFT OUTER JOIN locations ON TruckCompanies.id_locations = locations.id
WHERE locations.name = &quot;Garden City&quot;;</code></pre></div><p>at least this gets the correct list when run in SQLiteStudio</p><p>this is what I get when I try that code</p><div class="codebox"><pre><code>SELECT id, &quot;TruckCompanies&quot;.&quot;Name&quot; FROM &quot;TruckCompanies&quot; WHERE locations.name = &quot;Garden City&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Mon, 06 Mar 2017 17:59:34 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19321#p19321</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19320#p19320</link>
			<description><![CDATA[<p>what I actually need on the calculator form<br />there is a place to choose the only the trucking company servicing this location<br />right now it shows trucking companies from all locations<br />also the products, the origins, and the destinations also all need to be filtered by the location they are tied to.</p><p>Maybe I am approaching this problem from the wrong direction?</p><p>I&#039;d actually like to filter in more ways to make the form smarter, once the trucking company is chosen, I&#039;d also like to refilter the output to the product/product type list so that only product the trucking company hauls are shown, and then again when the product has been chosen with only origins that this trucking company service and have this product, and then again only destinations that this trucking company delivers this product to.</p><p>and before I go that way I guess I need to check with the user if that logic makes sense.&nbsp; It might be better to reorder to choose the product first, then filter by locations that can provide that product etc...</p><p>ps.. I already have</p><div class="codebox"><pre><code> 1=1 Order By Name asc</code></pre></div><p> in the filter line on the form item so it sorts alphabetical.</p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Mon, 06 Mar 2017 13:02:20 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19320#p19320</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19319#p19319</link>
			<description><![CDATA[<p>the .dbupdate line errors on my version 3.2&nbsp; is that a new feature?</p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Mon, 06 Mar 2017 12:46:09 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19319#p19319</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19308#p19308</link>
			<description><![CDATA[<p>Hello Timlitw,<br />Not sure if I&#039;m missing something (probably - LOL!).&nbsp; Can&#039;t you filter the comboboxes in the same way that you filter the grids (using the vlocation filter in my previous attachment).&nbsp; That was the thinking behind the approach I took to make it re-usable.<br />The relevant code (in my attachment) is:<br />formcalculate.combobox1.dbFilter := &#039;location = &quot;&#039;+vlocation+&#039;&quot;&#039;;<br />formcalculate.combobox1.dbupdate;<br />I&#039;ve added it to this attachment (user passwords are 100, 200, 300, 400 and administrator passwords are tim, derek).<br />Let me know if I&#039;ve missed something.<br />Regards,<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Sun, 05 Mar 2017 15:39:42 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19308#p19308</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19302#p19302</link>
			<description><![CDATA[<p>That worked great Thanks!</p><p>the next step is to limit the comboboxes on the Calculator form</p><p>I found that there is an option to fill them with sql.<br />so I am looking into how this will work</p><p>Form1.ComboBox1.dbSQLExecute (&#039;SELECT fieldname, id FROM tablename&#039;);</p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Sat, 04 Mar 2017 13:45:41 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19302#p19302</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19299#p19299</link>
			<description><![CDATA[<p>thanks for the explanation, I see where it is doing that now.</p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Sat, 04 Mar 2017 01:37:33 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19299#p19299</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19298#p19298</link>
			<description><![CDATA[<p>Hi Timlitw,<br />I get the relevant user location from the password table using the entered password as the key and store it in a variable (vlocation).<br />I then pass that location through as a &#039;real time&#039; filter to the grid with :&nbsp; &nbsp; <br />form1.tablegrid1.dbfilter := &#039;location = &quot;&#039;+vlocation+&#039;&quot;&#039;;<br />It seemed an easy way of automating what you&#039;d otherwise do manually with a &#039;search&#039; button and a combobox filter.&nbsp; But because it&#039;s done programatically, it stops the user being able to see locations other than their own (unless you&#039;re an administrator) yet also allows hundreds of locations to be added without needing any modifications.&nbsp; And because vlocation is global, the code can be re-used against any tablegrid in your project where you need to restrict location. <br />So, from what I understood of your requirement, it seemed to offer a &#039;win-win&#039;.<br />I downloaded your attachment - it looks an interesting project.<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Fri, 03 Mar 2017 22:08:17 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19298#p19298</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19292#p19292</link>
			<description><![CDATA[<p>Sorry - I thought I had attached my project </p><p>I&#039;ve looked at your sample and Im not sure yet how you made it work that way.</p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Fri, 03 Mar 2017 15:12:09 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19292#p19292</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19269#p19269</link>
			<description><![CDATA[<p>Hello Timlitw,<br />I didn&#039;t realise you&#039;d have so many locations.<br />So, I&#039;ve altered my original approach to allow for this;&nbsp; whatever the user location, the script just reads it and filters a common tablegrid accordingly.&nbsp; &nbsp;The user only sees the data for their location.&nbsp; As an administrator, you get to see ALL locations and to maintain the reference tables (passwords, locations etc).<br />Valid administrator passwords are &#039;derek&#039; and &#039;tim&#039;&nbsp; Valid normal user passwords are &#039;celtic&#039;, &#039;derry&#039;, &#039;100&#039; - but you can see them all in the passwords table if you go in as an administrator.<br />Because there is hardly any data, I also put the location into the caption at the top of the form (as confirmation that it is switching locations correctly, according to the user you&#039;ve logged in as).<br />I think this should address the concerns about the possible number of locations that you have.<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Wed, 01 Mar 2017 20:43:14 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19269#p19269</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19256#p19256</link>
			<description><![CDATA[<p>Hello Timlitw,<br />I&#039;ve modified one of my apps to see if it might get you a bit closer to what you want to do.<br />I use a password table with 2 fields (password and location) and then automatically filter tablegrids depending on the location associated with that password.<br />Try different passwords and you&#039;ll see how it points you to different locations (warehouses in my example);&nbsp; it&#039;s all transparent to the user.<br />Table maintenance (click the &#039;database&#039; icon to see a full list of passwords and their locations that have been set up) is only permitted against a password that has a location of &#039;ALL&#039; (this is typically your supervisor/administrator).&nbsp; In the attachment, the passwords that have &#039;ALL&#039; associated with them are &#039;A1B2C3&#039; and &#039;eish&#039; which you&#039;ll need to run the application.&nbsp; <br />It&#039;s a pretty simple solution (but that doesn&#039;t necessarily make it bad - LOL!!).<br />Hope this helps to move things along.<br />Regards,<br />Derek.</p>]]></description>
			<author><![CDATA[null@example.com (derek)]]></author>
			<pubDate>Tue, 28 Feb 2017 19:54:27 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19256#p19256</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19243#p19243</link>
			<description><![CDATA[<p>here is an example of my script</p><div class="codebox"><pre><code>var
   sUser: string = &#039;&#039;;
   sLocation: string = &#039;&#039;;

procedure Settings_OnShow (Sender: string; Action: string);
begin
    Settings.location.Text := sLocation;
    Settings.Button19.Click; //populate Trucking Companies grid with only users location
end;</code></pre></div><p>on the settings form there is as table grid that shows the trucking companies - the table grid settings show all the companies no matter who is logged in or thier &quot;location&quot;&nbsp; so on the form I put a field text field and fill it from sLocation<br />Settings.location.Text := sLocation; <br />and then a button Settings.Button19.Click; that runs a sql query to fill the tablegrid with data filtered by the users locations that it gets from the text field.<br /></p><div class="codebox"><pre><code>SELECT TruckCompanies.id as &quot;id&quot;,
       TruckCompanies.Name as &quot;Trucking Company&quot;,
       locations.name as &quot;Location&quot;

 FROM TruckCompanies
 LEFT OUTER JOIN locations ON TruckCompanies.id_locations=locations.id
WHERE locations.name LIKE &#039;%{location}%&#039;;</code></pre></div><p>this seems like a poor work around your example seems a lot better - I just don&#039;t know where to fit it in.</p><p>actually I just added the second location in my data and realized&nbsp; pretty much every tablegrid and every dropdown<br />will need filtering by the location and the mess I made above isn&#039;t going to work.</p><p>the requirements are that users form seperate locations shuld not see each others entries, but seperate users from the same location should be able to see each others entries.</p><p>and finally an admin should be able to see and extract the data from all locations to be able to run cost reports.</p><p>here is my project - it works pretty well for one location as it was originally written - I&#039;ve started adding the code and ability to have more than one location but with these filtering issues I am in over my depth. <img src="https://myvisualdatabase.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (timlitw)]]></author>
			<pubDate>Tue, 28 Feb 2017 12:50:38 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19243#p19243</guid>
		</item>
		<item>
			<title><![CDATA[Re: logged in user and tablegrids & Comboboxes]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=19238#p19238</link>
			<description><![CDATA[<p>Not sure that I have understand your question correctly.</p><br /><p>You can use property dbFilter of TableGrid to filter it without Textbox component.</p><div class="codebox"><pre><code>Form1.TableGrid1.dbFilter := &#039;location=&quot;city&quot;&#039;;
Form1.TableGrid1.dbUpdate;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DriveSoft)]]></author>
			<pubDate>Tue, 28 Feb 2017 11:31:45 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=19238#p19238</guid>
		</item>
	</channel>
</rss>
