Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  filters in table lookup

phpMyEdit General     filters in table lookup
Post new topic   Reply to topic    
 
ChadR     Joined: 19 Mar 2007   Posts: 3  
Post Posted: 2007-12-06 09:19
Back to top  Reply with quote     

I'm trying to filter out certain records from a table lookup. Specifically, records that have been "marked" deleted. My db looks like this...

table asset (assetID, name, modelID, ..., deleted)
table model (modelID, model, deleted)

When adding/editing an asset, I don't want models listed that have been "deleted". Since i used the same 'deleted' column names in both tables, i tried this...

$opts['fdd']['modelID']['name'] = 'Model';
$opts['fdd']['modelID']['values'] = array(
'table' => 'model',
'column' => 'modelID',
'description' => array('columns' => array('model')),
'filters' => '$join_table.deleted != "1"'
);

Apparently this causes known problems in version 5.6. See, http://opensource.platon.sk/forum/projects/viewtopic.php?t=902) which is exactly the problems I'm seeing.

So, I thought I'd try a different approach. I altered the tables to have unique 'deleted' column names to avoid having to use the $join_table references...

table asset (assetID, name, modelID, ..., deleted)
table model (modelID, model, model_deleted)

By using a simple filter of...
'filters' => 'model_deleted != "1"'
This solved the php/mysql errors and got half the functionality I want... doesn't crash or display the "deleted" rows in the model list.

However, as expected, the "lookup" does not return anything for the existing value if it has been deleted, so just the modelID is displayed in list/view. As a test, I used the values2 array and hard coded a modelID/model pair for a deleted row and that does add it to the top of the list before the 'values' lookup list. So, the question is...

How can I get 'values2' to have the modelID/model pair for the current values when needed.... and not throw-up an error. I could live with just always having the existing entry at the top of the list.. even if it is repeated.

1.) use some kind of separate pre-lookup, or maybe
2.) use a complex filter? or join? (that doesn't break)

I'd appreciate any suggestions or solutions. Thanks.

Chad R.

 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2007-12-13 09:30
Back to top  Reply with quote     

1. there was an error in pme code, which made it behave different than the documentation said. so work with the newest version (cvs or release 5.7.1)

2. there are two values option
filters: applied during add/change
join: applied during view/list/..

see
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html#AEN1011
for a nice example of join option, just after add it should be $join_table.deleted = 0

filters should be deleted = 0

that should do the job, but use a new pme version.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy