This topic is locked

Another AJAX Look-Up Inquiry

9/14/2007 12:25:25 AM
PHPRunner General questions
A
almond author

Hope someone can help a newbie.
I am new with PHPRunner and have downloaded the trial version 4 Build 265. I have successfully implement 3 LookUp with AJAX Pop which is dependent on one key field. Now my problem is that among those 3 look up is a key field from another table which is related to the main table (e.g tblCrew is related to tblPosition by PosNbr field). I can successfully display in my form the IDNo, PosNbr & CrewName but I also would like to display in the same form PosNbr's description which is found in the tblPositions. Is there a way to do these? I have beent trying to find some solutions but those which I saw is a little bit hard to understand for a newbie like me.
Thanks in advance for the help and hope someone can really help me out.
More Power to PHPRunner...
almond

Alexey admin 9/14/2007

Almond,
it's hard to give an advice without more detailed description of your project.
Show your main and lookup tables structure and describe how your lookup wizards are set up and I'll try to help you.

A
almond author 9/16/2007

Thanks for the reply...
here are the two tables that i am talking about.
CREATE TABLE `tblcrew` (

`IDNbr` int(11) unsigned NOT NULL auto_increment,

`MNNbr` int(11) default NULL,

`LName` varchar(25) default NULL,

`FName` varchar(25) default NULL,

`MI` varchar(25) default NULL,

`PosNbr` int(11) default NULL,

`PrevPosNbr` int(11) default NULL,

`VesselCode` int(11) default NULL,

`FormerVesselCode` int(11) default NULL,

`NextVesselCode` int(11) default NULL,

`DateDepMla` date default NULL,

`DateSignedOn` date default NULL,

`ExpDueDate` date default NULL,

`DateSignedOff` date default NULL,

`SignOffStatusCode` varchar(255) default NULL,

`Remarks` text,

`LatestReportDate` date default NULL,

`AvailableDate` date default NULL,

`ECPlanStat` varchar(15) default NULL,

PRIMARY KEY (`IDNbr`)

)
CREATE TABLE `tblplanning` (

`PlanID` int(10) unsigned NOT NULL auto_increment,

`VesselCode` int(11) default NULL,

`OBMNNbr` int(11) NOT NULL,

`OBRank` varchar(15) default NULL,

`OBCrew` varchar(75) default NULL,

`OBPlanStat` varchar(15) default NULL,

`DateJoined` date default NULL,

`EOC` date default NULL,

`Port` varchar(75) default NULL,

`OSMNNbr` int(11) NOT NULL,

`OSRank` varchar(15) default NULL,

`OSCrew` varchar(75) default NULL,

`OSPlanStat` varchar(15) default NULL,

`Status` char(3) default NULL,

`Wagescale` varchar(15) default NULL,

`Flagstate` varchar(75) default NULL,

`Remarks` text,

`ECPlanStat` varchar(15) default NULL,

PRIMARY KEY (`PlanID`)

)
CREATE TABLE `tblposcode` (

`PosNbr` int(11) default NULL,

`Position` varchar(50) default NULL,

`PosName` varchar(50) default NULL,

`PositionStatus` int(11) default NULL,

`PosNbrID` int(11) NOT NULL,

`PosNbrOld` int(11) default NULL,

`SortCode` double default NULL,

`DeptCode` double default NULL,

PRIMARY KEY (`PosNbrID`)

)
in the form of tblplanning i have successfully made 3 AJAX Look up fields based on the `OBMNNbr which is the 1st Look-Up and based on it I am able to display `OBRank`, `OBCrew` details coming from another table called tblCrew. Theh `OBRank`is just the same field as `PosNbr` in the table tblposcode which is also saved in the table tblcrew, while `OBCrew`is the complete name of the crew found in table tblCrew as. As i've said i have successfully displayed all the details except that I want to display the corresponding description of `OBRank` which as ive said same`PosNbr. The description will be coming from the table tblposcode which is the field `Position. Here is what i have now


and here is somewhat what i want to do


Hope my explanation helps...
Thanks in advance for the help...
almond

Almond,

it's hard to give an advice without more detailed description of your project.
Show your main and lookup tables structure and describe how your lookup wizards are set up and I'll try to help you.

Alexey admin 9/17/2007

Almond,
I recommend you to do the following.

Create a view in your database based on tblCrew and tblPositions tables.

I.e.

create view v_Crew as

select tblCrew.*, tblPositions.Description

from tblCrew

left join tblPositions on tblPositions.PosNbr = tblCrew.PosNbr

Then use v_Crew instead of tblCrew as lookup table.

Select Descriptionin Display field box or use Custom expressionthere:

concat(PosNbr,' - ',Description)

A
almond author 9/20/2007

Alexey,
Much thanks for the help, now its working great...
Until next time....
Almond