Topic: Show tablegrid when displaying detail from table

I am showing the details of a vendor record and would like to have my tablegrid below
show all records from my order table that has the relationship to my vendor record.

I am therefore trying to use the auto query to select from the orders table
with a filter of vendor.id = order.id_vendor
and I get a syntax error.  Is there a way to automatically run this sql
query without having to add a button to launch a specific SQLExecute command?

Thank you,
  Robb

Re: Show tablegrid when displaying detail from table

Hi Robb,
The relationship specified between your vendor and order tables already filters the orders raised against different vendors.
The filter on the auto-query would be if you wanted to additionally filter certain orders within the selected vendor (ie all orders over £100 or all orders older than 30 days etc).
Attached is a small project which is relevant to your example which might clarify things.
Derek.

Post's attachments

Attachment icon rjkantor.zip 337.39 kb, 525 downloads since 2016-02-24 

Re: Show tablegrid when displaying detail from table

It appears that if I check the Enable auto execution of the query all records are returned.  I unchecked that box and now only relevant records are displayed.

Re: Show tablegrid when displaying detail from table

How do I enable Auto Execution of the query? I think I have everything setup correctly in the Set up auto query screen but I'm getting no results. I don't have a search button, just want to display the data in the table.

5 (edited by derek 2020-12-09 19:18:32)

Re: Show tablegrid when displaying detail from table

Hi Alan,
If you're not using a search and just want to display all the data from a table and yet no data is shown, the first thing to suspect is that the 'show all records from the table' radio button hasn't been clicked in the tablegrid's properties (see screenshot).
Of course, it might be something else, so if you attach your project, someone will be able to check it out.
This isn't, however, quite the same thing as 'autoexecution' of a query (which is something called 'incremental search'.  In my earlier post back to you on your reporting query, you can see examples of 'incremental searching' - this is basically when you start to enter a value in a search field and the results in the tablegrid and filtered 'real time' rather than waiting for you to click on the 'search' button.
Derek.

Post's attachments

Attachment icon asawyer.jpg 242.3 kb, 108 downloads since 2020-12-09 

Re: Show tablegrid when displaying detail from table

I think it's an issue the first time I go into it.
I added a form to add a record and once it's added, and the form is closed the grid shows all the proper records.

So I think I just need to trigger the grid to load.

Alan

Re: Show tablegrid when displaying detail from table

I did a tablegrid1.dbUpdate on the OnShow event for the form1 and it worked.

Re: Show tablegrid when displaying detail from table

If you're just using standard MVD to maintain records, there should be no need to do any updating by script.
If you attach your project, someone can have a look.
Derek.