where condition

Filter related data in a CF form using a WHERE condition.

Overview

The WHERE condition references a form variable that is not being passed to the data action.
Check the form debugger to locate the correct variable name for the customer ID and use that variable in your WHERE condition.

Answered
ChronoForms v7
ec economyweb 13 Oct, 2021
Answer
I have a list of customers in the page_list
When I edit a customer it opens perfectly in edit_customer_page and I can modify and update it.
Below the customer data I show a table with the related contacts of this customer.

For this I have a read data that reads the contacts table and shows them ALL.
I need to put a where condition to limit only those of the client in edit.

When I put it:
where condition -> contacts.company = {var: customer.id}

debug shows:
select contacts where company = ' '
It seem that, {var: customer.id} has no value and is just the one that I have active on the screen.
Gr GreyHead 14 Oct, 2021
Hi economyweb,

The Debugger output should also show you where the customer id is in the form data.

Bob
This topic is locked and no more replies can be posted.