Subject |
Re: GRID DISPLAY |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Wed, 18 Oct 2017 08:17:20 +0200 |
Newsgroups |
dbase.getting-started |
On 2017-10-17 8:35 PM, Mustansir Ghor wrote:
> Dear Heinz
>
> The information were very useful. 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?
What is the contents of mq1? (It must be a valid SQL statement.)
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.
|
|