How? Custom SQL for lookup but using value from record as WHERE
Posted: 2021-01-07 12:12
Hi,
I have this setup:
Table tbl_boxes: Holds boxes
Table tbl_customers: hols customer information
Table tbl_customers_boxes: holds current (!) relation between customers and boxes (m:n). The relation will change.
Table tbl_jobs: holds jobs that need to be done with tbl_boxes.
In tbl_jobs the customer needs to be saved forever (history). For this reason I would pull him from tbl_customers (where he always exists) and not from tbl_customers_boxes (as the customer can vanish from tbl_customers_boxes).
Problem: I can not do this in AG with the lookup afaik.
I can not use a "dependent lookup" with tbl_customers (with tbl_customers_boxes it would work), but I need to show only customers for a job that actually have currently an entry in the current tbl_customers_boxes table.
So I am wondering, if I can use a field from the current record (ID_boxes) in my custom lookup query - and if yes, - how do I do this?
If no, it would be a great feature to be able to use a field from the current record in a custom lookup query.
Olaf
I have this setup:
Table tbl_boxes: Holds boxes
Table tbl_customers: hols customer information
Table tbl_customers_boxes: holds current (!) relation between customers and boxes (m:n). The relation will change.
Table tbl_jobs: holds jobs that need to be done with tbl_boxes.
In tbl_jobs the customer needs to be saved forever (history). For this reason I would pull him from tbl_customers (where he always exists) and not from tbl_customers_boxes (as the customer can vanish from tbl_customers_boxes).
Problem: I can not do this in AG with the lookup afaik.
I can not use a "dependent lookup" with tbl_customers (with tbl_customers_boxes it would work), but I need to show only customers for a job that actually have currently an entry in the current tbl_customers_boxes table.
So I am wondering, if I can use a field from the current record (ID_boxes) in my custom lookup query - and if yes, - how do I do this?
If no, it would be a great feature to be able to use a field from the current record in a custom lookup query.
Olaf