December 13, 200718 yr Hi What I've done is to create a page with two record sets: From a results page you click on a link to the client record. The client record page has two record sets on it; the client detail (from the clients table) and all jobs linked to that customerID (from the Jobs table). When you click on a link, if there are jobs against that client, everything displays fine, however, if there are no linked jobs for a client the jobs record set returns goes to the error page and gives a 401 error . How do I get it to suppress that error and still display the client detail from the clients table whether there are linked jobs or not? I would have just used a portal but need record set paging and this doesn't seem to work for portals. Alternatively, is there a way I can trap the 401 error and ignore it? Any suggestions gratefully accepted!! Here is the PHP code I'm using: <?php require_once('Connections/PressLogin.php'); ?> <?php // get variable from URL and set to $Variable $ActiveJobs = $_GET['ActiveJobs']; ?> <?php $PressLogin_find = $PressLogin->newFindCommand('Clients_Web'); $PressLogin_findCriterions = array('KP_CustomerID'=>'=='.fmsEscape($_GET['KP_CustomerID']),); foreach($PressLogin_findCriterions as $key=>$value) { $PressLogin_find->AddFindCriterion($key,$value); } $ActiveJobs_find = $PressLogin->newFindCommand('Jobs_Web'); $ActiveJobs_findCriterions = array('ActiveStatus'=>$ActiveJobs,); foreach($ActiveJobs_findCriterions as $key=>$value) { $ActiveJobs_find->AddFindCriterion($key,$value); } fmsSetPage($PressLogin_find,'PressLogin',10); fmsSetPage($ActiveJobs_find,'ActiveJobs',10); $PressLogin_result = $PressLogin_find->execute(); $ActiveJobs_result = $ActiveJobs_find->execute(); if(FileMaker::isError($PressLogin_result)) fmsTrapError($PressLogin_result,"error.php"); if(FileMaker::isError($ActiveJobs_result)) fmsTrapError($ActiveJobs_result,"error.php"); fmsSetLastPage($PressLogin_result,'PressLogin',10); fmsSetLastPage($ActiveJobs_result,'ActiveJobs',10); $PressLogin_row = current($PressLogin_result->getRecords()); $ActiveJobs_row = current($ActiveJobs_result->getRecords()); $ActiveJobs__Clients_portal = fmsRelatedRecord($ActiveJobs_row, 'Clients'); $ActiveJobs__JobsActiveJobs_portal = fmsRelatedRecord($ActiveJobs_row, 'Jobs_ActiveJobs'); // FMStudio v1.0 - do not remove comment, needed for DreamWeaver support ?> Edited December 13, 200718 yr by Guest Added Code Tags
December 13, 200718 yr It looks to me like your returning all active jobs - not those that are related to your client...
December 13, 200718 yr Author The active jobs field is basically a calculation that concatenates the CustomerID with an active job identifier and this is used to create the relationship. If there is an active job for the client it works perfectly, however, if there isn't, the ActiveJobs recordset generates and error and sends it to the error page - I want it still display the client detail page.
December 13, 200718 yr Remove this line: if(FileMaker::isError($ActiveJobs_result)) fmsTrapError($ActiveJobs_result,"error.php"); Put this around the last three lines: if( !FileMaker::isError($ActiveJobs_result) ) { } e.g. if( !FileMaker::isError($ActiveJobs_result) ) { $ActiveJobs_row = current($ActiveJobs_result->getRecords()); $ActiveJobs__Clients_portal = fmsRelatedRecord($ActiveJobs_row, 'Clients'); $ActiveJobs__JobsActiveJobs_portal = fmsRelatedRecord($ActiveJobs_row, 'Jobs_ActiveJobs'); }
December 13, 200718 yr Author Thanks for that - it now at least starts to load the page, but doesn't display any content below that - but it feels like progress!! I've attached a screen shot so you can see what I mean
December 13, 200718 yr I really can't help without seeing some more code.. The above code runs a search and that's it, the output isn't there and so I can't really tell you what's going on.
Create an account or sign in to comment