Subject Re: GRID DISPLAY
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Wed, 18 Oct 2017 19:40:36 +0530
Newsgroups dbase.getting-started

On 18/10/2017 11:47, Mervyn Bick wrote:
> 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.

A question
In his original message mustansir had used the code
        form.billsort= mq1
Can we assign query objects in the above pattern.

If yes then I can use on the following pattern
r = new report
r.rowset = form.rowset

Presently I am use the same datamodule for both the report and form.
In the form I use the following code. All the required rowsets are
available in the form.

    function PRINT_onClick()
       set procedure to p_tax.rep
        r = new p_taxreport()
        r.taxdatamodule1.tax2.params["invoice"] = minvoice
        r.taxdatamodule1.tax2.requery()
        r.taxdatamodule1.tax1.params["invoice"] = minvoice
        r.taxdatamodule1.tax1.requery()
        r.taxdatamodule1.ptax.params["invoice"] = minvoice
        r.taxdatamodule1.ptax.requery()
        r.taxdatamodule1.disco.params["invoice"] = minvoice
        r.taxdatamodule1.disco.requery()
        if r.printer.chooseprinter()
                r.render()
                r.PAGETEMPLATE1.COPY.text = "Duplicate Copy"
                r.render()
                r.PAGETEMPLATE1.COPY.text = "Office Copy"
                r.render()
        endif
        close procedure p_tax.rep
        form.footer.add.setfocus()
       return

This code is working fine but still wanted to know out of curosity.
Regards
Akshat