This topic is locked

Master-detail where detail is 'x' when..

11/1/2005 3:21:38 AM
PHPRunner General questions
OCTheEagle author

Hi,
I've got the following situation.


What I want to do is the following.

Table 'dossiers' is the default view.

When you add a new dossier you can specify three values for 'category': RP, FP and BB.
When you choose RP you get a master-detail relationship between the tables 'dossiers' and 'RP'. When you choose FP you get a master detail relationship between 'dossiers' and 'FP' etc.
Reason behind this is that the tables 'RP' , 'FP' and 'BB' contain different fields (which cannot be seen on the picture yet).
Is this situation possible?

admin 11/1/2005

Hi,
this can be done with a slightly simple modification of generated files.
First, set the Dossiers table as a Master for RP,FP and BB tables on Datasource table tab in PHPRunner.
Build the pages.
Then open generated dossiers_list.php file with a text editor and do the following:

  1. Modify the WriteTableHeader() function to show only one column for detail tables instead of three.
  2. Locate the following snippet inside loopRS() function:
    <td align=center>

    <a href="RP_list.php" onClick = "document.forms.details.action='RP_list.php';document.forms.details.masterkey.value='<?php echo db_addslashes($data[RemoveFieldWrappers("ID")]);?>'; document.forms.details.submit();return false;">

          RP

    </a>

    </td>



Modify it this way:

<td align=center>

<a href="#" onClick = "document.forms.details.action='<?php

  if($data["Category"]=="1")

    echo "RP_list.php";

  else if($data["Category"]=="2")

    echo "FP_list.php";

......
?>
';document.forms.details.masterkey.value='<?php echo db_addslashes($data[RemoveFieldWrappers("ID")]);?>'; document.forms.details.submit();return false;">

      Details

</a>

</td>



Then delete the similar snippets fro FPand BBtables.