DBGrid dblookupcombobox from depended query

86 views
Skip to first unread message

enver penjo

unread,
Apr 4, 2022, 11:31:22 AM4/4/22
to Rosi Delphi Components
For example:
I have added table delivery where we can add orderid and when we add it then we should be choose (from lookup) products from that orderid.
northwind_delivery.rar
northwind.rar

Tomas Rosinsky

unread,
Apr 4, 2022, 4:02:28 PM4/4/22
to Rosi Delphi Components
Hi, 

it could be easily done by custom code. Use Field.OnChange event for orderId and set the list for the lookupcombo according to used orderId - e.g.  add condition for orderId and requery dataset for the list.
Or use my rDBComboBoxUDB which supports using of internal dataset with conditions....

Tomas

Dne pondělí 4. dubna 2022 v 17:31:22 UTC+2 uživatel penj...@gmail.com napsal:

enver penjo

unread,
Apr 4, 2022, 5:19:12 PM4/4/22
to Rosi Delphi Components
i Have added:
procedure TForm5.qDeliveryorderidChange(Sender: TField);
var a,s:string;
begin
  a:=':'+qDelivery.FieldByName('orderid').AsString;
  with self.qOrderDetails do begin
       s:=stringreplace(sq,':OrderID',a,[]);
       sql.Text:=s;
       open;
  end;
end;

But nothing happens!

Tomas Rosinsky

unread,
Apr 5, 2022, 6:30:50 AM4/5/22
to Rosi Delphi Components
Thanks for information :)

Dne pondělí 4. dubna 2022 v 23:19:12 UTC+2 uživatel penj...@gmail.com napsal:

enver penjo

unread,
Apr 6, 2022, 7:52:34 PM4/6/22
to Rosi Delphi Components

It did not help!

Tomas Rosinsky

unread,
Apr 7, 2022, 1:34:03 AM4/7/22
to Rosi Delphi Components
There was no question in your message so what did you expect from me? 
It is your code and the issue is not related to my components, you have probably wrong sql statement (char : should not be here). 
If you want me to check and fix your code next time we can make a deal, no problem. Just explain what is expected and I will provide the solution for free as many time before or send you the expected price for my time. ok?

Thanks for understanding.
Tomas

Dne čtvrtek 7. dubna 2022 v 1:52:34 UTC+2 uživatel penj...@gmail.com napsal:
Reply all
Reply to author
Forward
0 new messages