Multi Field Filter Lookup

Tips submitted by PHPMaker users
Post Reply
apmuthu
User
Posts: 5

Multi Field Filter Lookup

Post by apmuthu »

Multi Field Href for PHPMaker fields

Use a common lookup table with the following fields:

LookUp (FieldNames in other tables to lookup here)
FldCode (Value to be stored in those lookedup fields in other tables)
FldDisplay (Description to be displayed in the select boxes for the lookedup field values above)

A sample schema for the lookup table is as below:

CREATE TABLE lookups (
LookUp varchar(20) NOT NULL DEFAULT '',
FldCode int(11) NOT NULL,
FldDisplay varchar(20) DEFAULT NULL,
PRIMARY KEY (LookUp,FldCode)
) ENGINE=InnoDB;

A sample schema for the target table where the fields to store the looked up values will be is as below:

CREATE TABLE institutions (
InstID int(11) NOT NULL AUTO_INCREMENT,
Institution varchar(100) NOT NULL,
InstTypeID int(11) DEFAULT NULL,
MinorityID int(11) DEFAULT NULL,
PRIMARY KEY (InstID)
) ENGINE=MyISAM;

Data for the lookups table bearing valid values for the 2 lookup fields in the target table above can be as below:

INSERT INTO lookups(LookUp,FldCode,FldDisplay) VALUES
('InstTypeID',1,'Central Government')
, ('InstTypeID',2,'State Government')
, ('InstTypeID',3,'Government Aided')
, ('InstTypeID',5,'Private')
, ('MinorityID',1,'')
, ('MinorityID',2,'Not Applicable')
, ('MinorityID',3,'Others')
, ('MinorityID',4,'Non Minority')
, ('MinorityID',5,'Christian Minority')
, ('MinorityID',6,'Muslim Minority')
, ('MinorityID',7,'Hindi Minority')
, ('MinorityID',8,'Malayalam Minority');

Tools -> Advanced Settings -> Project -> Initiate search panel as collapsed -> Check it
The target table must have the filter fields in the set of list fields

To display a link on FldCode field in lookup table (lookups) that needs another field's value (from same table) as part of the URL to filter records (based on several fields that use the same lookup table) in another table (institutions), use the following:

form field in PHPMaker:

Href:
FldCode

Original field value:
Tick it

Target:
_self

Prefix:
institutionslist.php?cmd=search&t=institutions&z{$this->LookUp->CurrentValue}=%3D&x{$this->LookUp->CurrentValue}=

Note the underscore prefixed to the LookUp field above. It is necessary for all fields other than the one being displayed.

The manual and the web help page need to be updated for Hyperlink -> Prefix at:
http://www.hkvstore.com/phpmaker/doc/fieldsetup.htm


Post Reply