close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Repeating table and repeating nested row

Thread began 7/21/2011 3:35 pm by Jared Lui | Last modified 7/26/2011 1:03 pm by Jared Lui | 5668 views | 15 replies |

Jared Lui

Repeating table and repeating nested row

I have read and reread several posts regarding nested repeats. Tried the David Powers approach and tried Tom Mucks extension and I am not sure either of those work for my situation or at least I need some advice as I am becoming confused.

I have 3 main tables: LINE; SERIES; FIGURES
FIGURES is a child of SERIES and SERIES is a child of LINE (if that makes sense)
Each table consists of many columns but for clarity these are the ones that matter in this post.

NOTE: from now on I plan to use camelCase for my columns names; thanks Jason.
LINE - Line_Id, Line_Name
SERIES - Series_Id, Series_Name, Line_Id
FIGURES - Figure_Id, Figure_Name, Series_Id, Line_Id

I have a Line_Details.php page that you get to from the Line_Results.php page. On this page I show all of the details of the LINE table.
I also have a repeating table with two rows. The top row contains the SERIES that are attached to this selected LINE. For example I have selected the LINE Star Wars from the results and am showing the details for it. There are 3 SERIES that belong to Star Wars in the series table (Vintage, Legacy, Clone). So I have 3 tables that appear on the same page each with the correct Series_Name and the rest of the details.

My issue lies in that I want the second row to list some details of the FIGURES that belong to the SERIES of each repeating table.

I figured repeating the table was easy and then repeating a row inside that table would work but CS4 says otherwise. All the examples I've seen are simple lists with only a column but I need to repeat a row as I need to have dynamic links to detail, delete, update links as well.

You can see it in action here to understand.

I just need some direction more than anything. Currently I am using only one recordset with INNER JOINS for the SERIES and FIGURES tables. I've tried using 2 and 3 recordsets and several methods including the Tuck and Powers way. I'm just confused and need some expert pointers of how you'd go about it. I can provide files/zips as needed.

figure_lines_Detail.php?Line_Id=1

Thanks,
Jared

Sign in to reply to this post

Ray BorduinWebAssist

You would use a standard Dreamweaver repeat region around the two rows. Then within the two rows you could nest another table with a DataAssist Repeated Selection.

If you want help implementing this it is something we could help with in a Premiere Support ticket.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jared Lui

I'll give this a whirl. The way I tried before gave me a message the DW couldn't do nested repeats.

Would I need separate recordsets or would my INNER JOINed rs work?

Thanks

Sign in to reply to this post

Ray BorduinWebAssist

You can't nest DW repeat regions, but you can nest a WA Repeat Selection inside a DW repeat region.

Probably a separate recordset is the better way to go, but you will need to move the recordset from the top of the page and nest it inside the loop for it to work properly.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jared Lui

Ah, that makes sense. Thanks for the advice.

Sign in to reply to this post

Jared Lui

Okay, I have solved the nested table issue for the most part. There really should be a solution recipe or something regarding this as it appears this is brought up a lot. In fact when I figure this out I may write up one myself and donate it to you.

Anyway, I have my tables and rows repeating from the look of it but I am having issues with the second recordset. Does anyone have a recordset example I can look at.

I'm having issues trying to create a proper filter using the value from the first recordset.

Looking at this link: figure_lines_Detail.php?Line_Id=1

You notice my SERIES table is repeating correctly and all 3 Series are individual. The FIGURES row is repeating in all 3 series tables. I hard coded the WHERE statement in the loop to return results. Its that recordset that I need help in creating the filter.

Attaching the zip for clarity.

Attached Files
figure_lines_Detail.zip
Sign in to reply to this post

Ray BorduinWebAssist

Yes... there is a little trick I came up with that you can use to filter one recordset with the value from another.

It won't work if you try to set a recordset parameter run-time value directly to a row in a previously created recordset... so what you can do is create a fake $_POST field and then set it to the recordset row in the code.

So say that you want to create a recordset parameter in Recordset2 and have it set to $row_Recordset1['fieldname']... instead in the DW recordset server behavior you set the run-time value to $_POST['Recordset1_fieldname'] and then in the code you manually add:

$_POST['Recordset1_fieldname'] = $row_Recordset1['fieldname'];

Just above the Recordset2 parameter reference (inside the repeat region). That will allow you to filter one recordset with the value from another as if it was filtered by a posted form value.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jared Lui

Thanks Ray. We'll see how that works.

Sign in to reply to this post

Jared Lui

I'm still screwing something up and can't sort out what it is. I think I misunderstand your instructions.

Here's my code with the stuff in bold being what I think your instructions state: This returns no repeated rows for the second recordset.

recordset1 = WADAfigure_lines and the column is series.Series_Id

<?php
$_POST['WADAfigure_lines_series.Series_Id'] = $row_WADAfigure_lines['series.Series_Id'];
$ParamSeriesID_rsFigures = "-1";
if (isset($_POST['WADAfigure_lines_series.Series_Id'])) {
$ParamSeriesID_rsFigures = (get_magic_quotes_gpc()) ? $_POST['WADAfigure_lines_series.Series_Id'] : addslashes($_POST['WADAfigure_lines_series.Series_Id']);
}

mysql_select_db($database_FIGURES, $FIGURES);
$query_rsFigures = sprintf("SELECT Figure_Name, Figure_Thumbnail, series.Series_Id FROM figures INNER JOIN series ON figures.Series_Id = series.Series_Id WHERE series.Series_Id = %s ORDER BY Figure_Name ASC", GetSQLValueString($ParamSeriesID_rsFigures, "int"));
$rsFigures = mysql_query($query_rsFigures, $FIGURES) or die(mysql_error());
$row_rsFigures = mysql_fetch_assoc($rsFigures);
$totalRows_rsFigures = mysql_num_rows($rsFigures);

// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsFigures){
?>
<tr>
<td><center><img src="../../images/figure_thumb/<?php echo $row_rsFigures['Figure_Thumbnail']; ?>" alt="" name="Figure_Thumbnail" id="Figure_Thumbnail" width="40" height="40" /></center></td>
<td><?php echo $row_rsFigures['Figure_Name']; ?></td>
<td align="right"><a href="#">Links</a></td>
</tr>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsFigures && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsFigures = mysql_fetch_assoc($rsFigures);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>

</table>
<br />
<?php } while ($row_WADAfigure_lines = mysql_fetch_assoc($WADAfigure_lines)); ?>

Sign in to reply to this post

Ray BorduinWebAssist

This looks right to me.... maybe the '.' in the field name is throwing it off? Maybe attach the full page and I might be able to spot the issue in context.

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...