Repeat a scraped field

I have this website I am trying to scrape that list one field only once, but I would like for it to repeat next to each tracking number. Basically it is the container number and numerous tracking numbers are inside the container number. I would like for the container number to repeat for each tracking number in the scrape. Is that possible. Below is a snippet of html code from the website.

The part I would like to repeat for each tracking number in the scrape

<tr>
<td>304382272463</td>
<td>Other</td>
<td>Bag</td>
<td></td>
</tr>
HTTP/1.1 200 OK
Server: Apache
Content-Type: text/html
Date: Wed, 20 Jan 2010 23:34:41 GMT
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<link rel="stylesheet" type="text/css" href='/consreport/css/cons.css' />
<script type="text/javascript" language="javascript" src='/consreport/javascripts/jscripts.js'>
</script>

<script type="text/javascript" language="javascript" src='/consreport/javascripts/xp_progress.js'>
</script>

<title>CONS Report : Destination/Service Report</title>
</head>
<body onload="">
<table width="760px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15px">&nbsp;</td>
<td width="745px" colspan="3">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><a href="http://www.fedex.com"><img src='/consreport/images/corp_logo.gif' align="left" border="0" /></a> </td>
<td><img src='/consreport/images/services_logo.jpg' align="right" border="0" /> </td>
</tr>

<tr>
<td colspan="2">
<hr size="1" />
</td>
</tr>

<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
</td>
</tr>

<tr>
<td width="15px">&nbsp;</td>
<td width="175px">
<table>
<tr>
<th colspan="2">
<div class="pageHeader" style="text-align: left">Menu</div>
</th>
</tr>

<tr>
<td width="10" valign="top"></td>
<td valign="top"><a href="/consreport/displayMainPage.do">Home</a> </td>
</tr>

<tr>
<td width="10" valign="top"></td>
<td valign="top"><a href="http://wsso.prod.fedex.com/consreport/explorer">CONS Explorer</a> </td>
</tr>

<tr>
<td width="10" valign="top"></td>
<td valign="top"><a href="/consreport/displayReportMenuPage.do">CONS Reports</a> </td>
</tr>

<tr>
<td width="10" valign="top"></td>
<td valign="top"><a href="/consreport/displayHelpPage.do">Help</a> </td>
</tr>

<tr>
<td width="10" valign="top"></td>
<td valign="top"><a href="/consreport/signout.do">Logout</a> </td>
</tr>
</table>
</td>
<td width="15px">&nbsp;</td>
<td width="555px">
<p class="pageHeader">CONS Destination/Service Detail Report</p>

<p class="contentbold" style="text-align: center">Top Level Cons Number: 304382272463</p>

<form name="dynaDummyForm" method="post" action="/consreport/detailReportAction.do">
<table class="report">
<tr>
<th>Cons Number</th>
<th>Cons Category</th>
<th>Cons Type</th>
<th>Additional Info</th>
</tr>

<tr>
<td>304382272463</td>
<td>Other</td>
<td>Bag</td>
<td></td>
</tr>
</table>

<br />

<table class="paging">
<tr>
<td>
<div style="text-align: center">Total Packages: 81</div>
</td>
</tr>
</table>

<br />

<table class="report">
<tr>
<th>Tracking No.</th>
<th>Origin</th>
<th>Origin Zip</th>
<th>Dest Loc</th>
<th>Dest Zip</th>
<th>Service</th>
<th>Cmit Date</th>
<th>Cmit Time</th>
</tr>

<tr>
<td>402398584865</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100031</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>410871406554</td>
<td>SDMA</td>
<td>91910</td>
<td>SHEA</td>
<td>110001</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>413499839146</td>
<td>ZSMA</td>
<td>95050</td>
<td>PEKA</td>
<td>100738</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>416778368170</td>
<td>SPQA</td>
<td>90058</td>
<td>TSNA</td>
<td>300020</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>419575656033</td>
<td>KAGA</td>
<td>135936</td>
<td>PEKA</td>
<td>100004</td>
<td>PO</td>
<td>01/19/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752865450</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100020</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752865471</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100020</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752865493</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100020</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752865519</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100020</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752865530</td>
<td>RBLA</td>
<td>92121</td>
<td>PEKA</td>
<td>101312</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752865541</td>
<td>RBLA</td>
<td>92121</td>
<td>PEKA</td>
<td>101312</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752866412</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100032</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752866673</td>
<td>RBLA</td>
<td>92121</td>
<td>BPXA</td>
<td>100020</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>424752867040</td>
<td>RBLA</td>
<td>92121</td>
<td>TAOA</td>
<td>266101</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>428806239168</td>
<td>HAFA</td>
<td>91325</td>
<td>SIAA</td>
<td>710061</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>430157755777</td>
<td>BTFA</td>
<td>84095</td>
<td>AKAA</td>
<td>100080</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>433226640682</td>
<td>POCA</td>
<td>91746</td>
<td>TAOA</td>
<td>266071</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>438618338027</td>
<td>OTSA</td>
<td>98052</td>
<td>PEKA</td>
<td>100123</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>617091732711</td>
<td>COAA</td>
<td>940892254</td>
<td>AKAA</td>
<td>100086</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>711369935350</td>
<td>HHRA</td>
<td>90502</td>
<td>PEKA</td>
<td>100738</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>711369935371</td>
<td>HHRA</td>
<td>90502</td>
<td>BPXA</td>
<td>100041</td>
<td>PO</td>
<td>01/22/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>793185819307</td>
<td>HHRA</td>
<td>90245</td>
<td>AKAA</td>
<td>100097</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>
<td>793188750711</td>
<td>WHPA</td>
<td>91775</td>
<td>BPXA</td>
<td>100763</td>
<td>PO</td>
<td>01/21/2010</td>
<td>18:00:00</td>
</tr>

<tr>

try using session variables

jsncochran,

Are you wanting the repeat the container number with each tracking number in your output? If so, you could just store it as a session variable and refer to it each time you need to.

Be sure to set the value to null prior to the next iteration in any looping you're doing because session variables stay in scope the length of the session.

session.setVariable("myVar",null)

-Scott

I want to repeat the

I want to repeat the container number for each tracking number that is scraped. What I do is input several container numbers to get the tracking numbers inside the container, but right now I never know what container that tracking number comes out of. That is why I would like to have a way to repeat the container number for each scrape.

I would like to have something like this on the output

Container Number Tracking Number
123456 1
123456 2
123456 3
123456 4
123456 5

jsncochran, So, you're saying

jsncochran,

So, you're saying you input several container numbers at the start of a scrape. Would it make sense to input only one container number and scrape all corresponding tracking numbers for that container? You could store the container number value in a session variable and use it when writing out each tracking number. Then repeat these steps for each container number?

Is there a reason you have to input multiple container numbers each time?

-Scott

Your exactly right Scott. I

Your exactly right Scott. I guess the problem I am running into is that I don't know how to write out a session variable. I have a list of over 200 container numbers and need the tracking numbers for each container. I have the container numbers saved in a csv file that loops through to pull out the tracking numbers in each container.

jsncochran, So, I'll assume

jsncochran,

So, I'll assume that when you parse the container number from the input CSV file you save it as a session variable in order to use it, say, as a post parameter when querying the site. You might refer to that session variable in the parameters tab using something like this.

~#contaner_num#~

Now, when you're writing out the tracking numbers that result from your extraction you can refer to the same container number variable in a script like this.

session.getVariable("container_num")

We have an example of a script that outputs to a CSV and other such helpful scripts in our Scripts Repository.

-Scott