Subject Re: GRID DISPLAY
From Mustansir Ghor <mustan31@hotmail.com>
Date Wed, 18 Oct 2017 14:52:45 -0400
Newsgroups dbase.getting-started

Dear Mervyn

for both queries sql property is "select * from accsales.dbf'.  The use of 2 queries was first one to be set for grid setting and second one was to update the file accsales with update data. All works fine but grid fails to display update data. Initially accsales file becomes empty with zap. Later it has update data but it does not display on the grid.

Regards
Mustansir


Mervyn Bick Wrote:

> On 2017-10-17 8:35 PM, Mustansir Ghor wrote:
> > Dear Heinz
> >
> > The information were very useferies ul. Thank you
> >
> > But interesting question came to mind. Assume billsort query was acitve at design time and later, and when this billsort = mq1 where mq1 is also an active query. Does this will make an impact on wherever there is datalnk to billsort rowset. Second if both these queries were pointing to one table billsort at initial and mq1 with table modified. If I had not used billsort = mq1, will billsort query had these ammendments reflected when mq1 was modified.
> >
>
> What is the original contents of the query's sql property?
form.billsort.sql = 'select * from accsales"

>
> What is the contents of mq1?  (It must be a valid SQL statement.)
mq1 = 'select * from accsales'
>
> You should have no problem displaying the rowset from a query in a grid
> provided you don't change the structure of the rowset.
>
> To change the SQL statement the query's active property must be false
>
> If, at design time, your query's sql is
>
>     sql = "select * from ORDERS.DBF"
>
> you can use the following as many times as you like and the new data
> should display in a grid without any further code.
>
>        form.orders1.active = false
>        form.orders1.sql = 'select * from orders where customerid =
> '+form.entryfield1.value
>        form.orders1.active = true
>
> It would be better to use a parameter driven query in which case you
> simply change the value of the parameter(s) and requery()
>
> If, on the other hand, you want to change the fields displayed you need
> to disconnect the grid from the query first.
>
>        form.grid1.datalink = ''
>        form.orders1.active = false
>        form.orders1.sql = 'select orderid,customerid,orderdate from
> orders where customerid = '+form.entryfield1.value
>        form.orders1.active = true
>        form.grid1.dataLink = form.orders1.rowset
>
>
> To display the selected fields for different customers you don't need to
> disconnect the grid but it will do no harm to reuse the same code.
>
>
> Mervyn.
>