Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  filters in table lookup

phpMyEdit General     filters in table lookup
Odoslať novú tému   Odpovedať na tému    
 
ChadR     Založený: 19.03.2007   Príspevky: 3  
Príspevok Zaslal: 2007-12-06 09:19
Návrat hore  Odpovedať s citátom     

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     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2007-12-13 09:30
Návrat hore  Odpovedať s citátom     

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.

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov