Forums

DB Multi Record Loader and Where condition

momentis 21 Mar, 2012
I have a form (FormA) that lists out information from a table, one field of which is named 'acct_user_id'. In this form listing, clicking on a particular field will open another form (FormB) that uses a DB Multi Record Loader action n the OnLoad event, based on a token. This token passes the value of 'acct_user_id' to the field 'created_by' on FormB. This works, and it displays all records from the underlying database table that FormB is pulling from.

What I want to do, however, is only pull certain records from the table that FormB is based upon. If I use a WHERE clause (type='com' AND package='users' AND action='login' AND status='logged in'), this supersedes the token being passed and returns ALL rows from the table.

How can I accomplish this?
GreyHead 22 Mar, 2012
Hi Rick,

It looks as though PHP will work in the WHERE box so try
 `type` = 'com' AND `package` = 'users' AND `action` = 'login' AND `status` = 'logged in' AND `created_by` = '<?php echo $form->data['acct_user_id']; ?>'
You might need to add a bit more code to check that acc_user_id actually ahs a value before it is added to the query.

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