Posts: 27
Threads: 10
Joined: Sep 2010
I have simple html table I have 5 row and 5 column
How I can capture particular column : then get value of corresponding column
Posts: 12,141
Threads: 143
Joined: Dec 2002
Can you give link to the web page?
Posts: 27
Threads: 10
Joined: Sep 2010
Suppose:
http://www.w3schools.com/html/html_tables.asp
Exp: I have Bananas in excel I have 2 column Name: Bananas, Mango, Apples
I want get percentage value of bananas... and store to different -2 string variable
Posts: 12,141
Threads: 143
Joined: Dec 2002
Example with other page. Table with 6 columns.
http://www.quickmacros.com/help/Tables/IDP_ASCII.html
Macro
Macro1461
out
HtmlDoc d.InitFromWeb("http://www.quickmacros.com/help/Tables/IDP_ASCII.html")
ARRAY(str) a
d.GetTable(1 a) ;;get the second table
int i
for i 0 a.len 6 ;;6 columns
,out a[i+4] ;;5-th column
Posts: 12,141
Threads: 143
Joined: Dec 2002
With fruits.
Macro
Macro1463
out
HtmlDoc d.InitFromWeb("http://www.w3schools.com/html/html_tables.asp")
ARRAY(str) a
d.GetTable(8 a)
int i
for i 0 a.len 2
,out "%s=%s" a[i] a[i+1]
Posts: 27
Threads: 10
Joined: Sep 2010
MY table is nested:
Error occour table not found
<table cellSpacing="2" cellPadding="2" width="750" border="0">
<tr>
<td height="20"></td>
</tr>
<tr class="lblBoldLarge">
<td>
Assignment Activities</td>
</tr>
<tr>
<td>
<table class="tableWhite" cellSpacing="2" cellPadding="2" width="100%" border="0">
<tr class="sectionHeader">
<td colSpan="2" height="20">
Add an Activity</td>
</tr>
<tr>
<td class="lblBold">
Activity Type:</td>
<td><select name="ddlActivityType" id="ddlActivityType" class="inputtext" onchange="ddlActivityType_onchange(this);">
<option value="...">Select</option>
<option value="vendormessage">Vendor message to client</option>
</select></td>
</tr>
<tr>
<td class="lblBold">
Date of Activity:</td>
<td><input name="txtDate" id="txtDate" type="text" class="date-pick" />
<span id="rfDate" controltovalidate="txtDate" display="Dynamic" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" initialvalue="" style="color:Red;display:none;">*</span>
<span id="cvDate" controltovalidate="txtDate" display="Dynamic" type="Date" dateorder="mdy" cutoffyear="2029" century="2000" evaluationfunction="CompareValidatorEvaluateIsValid" operator="DataTypeCheck" style="color:Red;display:none;">*</span>
<tr>
<td class="lblBold" vAlign="top">
Comments:</td>
<td><textarea name="txtComment" id="txtComment" class="inputtext" onblur="hlOff(this);" onfocus="hlOn(this);" rows="4" cols="100"></textarea></td>
</tr>
<tr>
<td class="lblBold" vAlign="top"> </td>
<td><input language="javascript" onclick="if(getObject('txtDate').value == ''){alert('Please enter date.');return false;} {if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) __doPostBack('cmdSave','')} " name="cmdSave" id="cmdSave" type="button" class="inputbuttonNeutral" value="Save" /> <input language="javascript" onclick="{if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) __doPostBack('cmdSaveEMail','')} " name="cmdSaveEMail" id="cmdSaveEMail" type="button" class="inputbuttonNeutral" value="Save and email" /></td>
</tr>
</table>
</td>
</tr>
<TR>
<TD>
</TD>
</TR>
<tr>
<td>
<table width="100%" border="0">
<tr class="sectionHeader">
<td height="20">
********************************************************I USE GIVEN BELOW TABLE******************************************
Activities History</td>
</tr>
<tr>
<td><table class="tablewhite" cellspacing="2" cellpadding="3" border="0" id="AssignmentActivityHistory_dgAssignmentActivity" style="width:100%;">
<tr>
<td class="gridHeader">Activity Date</td><td class="gridHeader">Created Date</td><td class="gridHeader">Created By</td><td class="gridHeader">Description</td><td class="gridHeader">Comments</td>
</tr><tr class="gridRowWhite">
<td>9/23/2010 3:33:20 PM</td><td>9/23/2010 3:33:26 PM</td><td>Kim Amandus</td><td>Shortlist</td><td>Submitted to Ecam (exempt)</td>
</tr><tr class="gridRowYellow">
<td>9/23/2010 3:33:02 PM</td><td>9/23/2010 3:33:09 PM</td><td>Kim Amandus</td><td>Review</td><td> </td>
</tr><tr class="gridRowWhite">
<td>9/23/2010 12:00:00 AM</td><td>9/22/2010 4:16:37 PM</td><td>archana sagar</td><td>Vendor message to client</td><td>Resubmitted at significant reduced rate. Please reconsider.</td>
</tr><tr class="gridRowYellow">
<td>9/22/2010 4:15:40 PM</td><td>9/22/2010 4:15:44 PM</td><td>archana sagar</td><td>Data Modified</td><td>
Pay Rate:43.6900
OT Pay Rate:43.6900
DT Pay Rate:43.6900
Bill Rate:54.6900
OT Bill Rate:54.6900
DT Bill Rate:54.6900
Inclusive Rate:54.6900
OT Inclusive Rate:54.6900
DT Inclusive Rate:54.6900
Exempt:True
ShiftPremium:False
Transition:False
PayRoll:False</td>
</tr><tr class="gridRowWhite">
<td>9/21/2010 4:16:13 PM</td><td>9/21/2010 4:16:15 PM</td><td>Kim Amandus</td><td>Rejected</td><td><br>Reason : Rejected - Agile-1<br> Comment : Rate too high- BR cannot exceed $50/hr</td>
</tr><tr class="gridRowYellow">
<td>9/21/2010 3:53:44 PM</td><td>9/21/2010 3:53:44 PM</td><td>archana sagar</td><td>Review</td><td> </td>
</tr>
</table>
**************************************************************************************
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td height="20"></td>
</tr>
</table>
Posts: 12,141
Threads: 143
Joined: Dec 2002
If table not found, probably wrong index used with GetTable. To get table index:
1. Open the web page in Internet Explorer.
2. Got to Quick Macros and open 'Find HTML element' dialog. It is in floating toolbar, 'Window, control' menu.
3. Capture the table.
4. If captured correctly, Tag must be TABLE. Index shows table index. Use it with GetTable.
Posts: 12,141
Threads: 143
Joined: Dec 2002
Your table has id attribute. It can be used as table name. Then don't need index.
Macro
Macro1458
out
HtmlDoc d.InitFromInternetExplorer(win("" "IEFrame"))
ARRAY(str) a
d.GetTable("AssignmentActivityHistory_dgAssignmentActivity" a)
int i
for i 0 a.len 5
,out a[i+4] ;;5-th column