[fx.php_list] Related records

  • From: "Van Buskirk, Trish" <pvanbuskirk@xxxxxxx>
  • To: "fx.php_list@xxxxxxxxxxxxx" <fx.php_list@xxxxxxxxxxxxx>
  • Date: Tue, 20 Dec 2016 20:02:27 +0000

I have two tables I am querying, related by LineCategoryID.  One is a PO table, 
the other contains services available per line item on the PO.

I have tried two separate searches; the first finding the Lines available on 
the entered PO #, then next querying the Services with the returned 
LineCategoryIDs.  I also tried putting a portal on the PO layout which displays 
the services.  I can't get either to work properly.  The only thing I've been 
able to get to work is adding a ListSvcs calculated field which is 
List(ServicesPO::ServiceName).  However, that won't work, as I need to create 
checkboxes for the user to select services.

Here's the bare-bones query I have done using 2 searches, which only returns 
the first service.

<?php
//            define('DEBUG', true);
                require_once('FX/FX.php');         // FX.php file
                include_once('include/server_data.php');

// IP address submitting form
$ip = $_SERVER['REMOTE_ADDR'];
$GL = $_POST['GL'];
$NR_GL = $_POST['NRGL'];
$NRPO = $_POST['NRPO'];
$PO = $_POST['PO'];

echo $GL."<br />";
echo $PO."<br /><br />";

// look up lines on PO
$polineQuery=new FX($dbHost,$port,$dbType,$conType);
$polineQuery->SetDBData('ReferenceTables', 'FSU_AUX_ITS_POS', 'all');
$polineQuery->setDBPassword($dbPass,$dbUser);
$polineQuery->AddDBParam ('GL_String', $GL);
$polineQuery->AddDBParam ('PO_No', $PO);
$polineQuery->AddDBParam ('CountServices', '0', gt);
$polineQuery->AddDBParam ('Descript', 'Telecom Non-Recurring', neq);
$polineQuery->AddSortParam('Descript', 'ascend');
$polineResults = $polineQuery->DoFXAction('perform_find');

foreach ($polineResults as $polines) {
                $poline=$polines['LineCategoryID'];
                $podesc=$polines['Descript'];
                echo $poline." - ".$podesc."<br />";

                // look up ITS services on PO lines
                $svclineQuery=new FX($dbHost,$port,$dbType,$conType);
                $svclineQuery->SetDBData('ReferenceTables', 'SvcListForWeb', 
'all');
                $svclineQuery->setDBPassword($dbPass,$dbUser);
                $svclineQuery->AddDBParam (POitemID', $poline);
                $svclineQuery->AddDBParam ('POCatID', '12', neq);
                $svclineQuery->AddDBParam ('TypeWorkOrder', 'Orders');
                $svclineQuery->AddDBParam ('Status', 'A');
                $svclineQuery->AddSortParam(ServiceName', 'ascend');
                $svclineResults = $svclineQuery->DoFXAction('perform_find');
                foreach($svclineResults as $svc) {
                                $svcline=$svc[ServiceName'];
                                echo $svcline."<br />";
                               }
}

Any assistance or direction would be GREATLY appreciated!

Thanks,
Trish V.

Other related posts: