Forums

Record Loader with WHERE clause

batvink 23 Apr, 2013
Hello all,

I am trying to load a record to populate the form:

Scenario
Form1: User enters data in 3 fields (order, name, date)
Call Form2
Form2: Record Loader gets a record where key is all 3 fields (if it exists)

I know the data is being passed from one form to the other okay (checked and confirmed). I cannot use the basic lookup because I have 3 fields. So I leave DB Field blank. In the Advanced tab, WHERE box, I add:

contractor_name = '<?PHP $form->data['contractor_name']?>'
AND
works_order = '<?PHP $form->data['works_order']?>'
AND
day1_date = '<?PHP $form->data['day1_date']?>'


I realise this syntax may be incorrect.

BUT I also get the On No/Empty Param Passed event triggered. Is this because I left the DB Field blank? How do I do this using the WHERE clause?

Many thanks for your help.
batvink 23 Apr, 2013
This works as described above, using the advanced WHERE clause:

<?PHP 
echo "contractor_name = '" . $form->data['contractor_name'] . "'";
echo " AND works_order = '" . $form->data['works_order'] . "'";
echo " AND day1_date = '" . $form->data['day1_date'] . "'";
?>


BUT You must put a dummy variable in the basic entry to avoid the error message.
This topic is locked and no more replies can be posted.