Subject Re: [IBO] Collated and parameterised query
Author SAFAK EBESEK
Dear Helen,

Thank you very mouch for your reply at 02:14.

** Question 1:
Where is the best place to add "COLLATE PXW_XXXX" and how ?
My solution after reading your message:
I added "CNAME=CNAME COLLATE PXW_XXXX" On SQL.Ordering tab
It works. Thank You.


** Question 2:
( I think I could not explain my sample )

Query : SELECT OPDATE STCODE, STINPUT, STOUTPUT, FROM STOCK
WHERE OPDATE>= :STDATE AND OPDATE<= :ENDATE
Sorting Setup :
OPDATE=OPDATE
STCODE=STCODE

Components : IB_DateTimePicker1, IB_DateTimePicker2, IB_Grid1,
Query1, IB_DataSource1, Button1

Goal : Fill Starting and Ending Dates to DateTimePicker1,2.
Press Button. Query should be ready as sortable for (OPDATE, STCODE)

Additional Setup:
DateTimePicker1.ParamName := 'STDATE'
DateTimePicker2.ParamName := 'ENDATE'

Abnormal Problem :
Query works. If user wants to sort it (by pressing title buton of
grid) , then Query appers empty. I check Monitor. Parameters (
STDATE, ENDATE) are NILL or 1858.

My solution :

procedure TForm1.BitBtn10Click(Sender: TObject);
begin
DM1.IB_Q3.ParamValues['STDATE']:= IB_DTP1.Date;
DM1.IB_Q3.ParamValues['ENDATE']:= IB_DTP2.Date;

Pub_t1 := IB_DTP1.Date ; // PUBLIC DEFINED AT FORM1
Pub_t2 := IB_DTP2.Date ; // PUBLIC DEFINED AT FORM1

DM1.IB_Q3.Refresh;
end;


procedure TDM1.IB_Q3OrderingChanged(IB_Dataset: TIB_Dataset);
begin
Form1.IB_DTP1.Date := Form1.Pub_t1;
Form1.IB_DTP2.Date := Form1.Pub_t2;

DM1.IB_Q3.ParamValues['STDATE']:= Form1.IB_DTP1.Date;
DM1.IB_Q3.ParamValues['ENDATE']:= Form1.IB_DTP2.Date;
end;

The last procedure could be shorter. But I wanted to expalin it.

My questions:
It works without problem.
Are there any short way ?

Many Thanks,
Safak