Lotus Script Agent not working on Domino 9 server - lotus-domino

I have an export to Excel agent that works great on my old 8.5 server. When I moved the database to a 9.0.1 server, the agent only exports one line at a time. If there are 30 lines in the view, you have to run the agent 30 times. What is different on a Domino 9 that would stop the agent from running through each line in the view?`Sub WriteViewasExcel (view As NotesView)
%REM
Agent ExporttoExcel
Created Mar 11, 2010 by Brian Moore/usr/nbt
Description: Comments for Agent
%END REM
Option Public
Option Declare
Sub Initialize()
Dim s As New NotesSession
Dim db As NotesDatabase
Dim qs As NotesView
Dim nv As NotesViewNavigator
Dim ne As NotesViewEntry
Dim Doc As NotesDocument
Set db = s.Currentdatabase
Set qs = db.GetView("Export")
Set nv = qs.CreateViewNav
Set ne = nv.GetFirst
Dim filename As String
Print |Content-Type:application/vnd.ms-excel|
filename="Excel "+db.Title+" "+Format(Now, "yyyy-mmm-d hhmm")+".xls" 'file name which will be suggested to user to save the resulting Excel file
Print |Content-Disposition: Attachment; filename="|+filename+|"| 'Triggers the save/open browser prompt instead of embedding the spreadsheet in the browser
Print ""
Print |<table border="1"><tr>
<td width="135"> <Center><b>Store Name</td></b>
<td width="80"> <Center><b>Date</td></b>
<td width="80"> <Center><b>Nontax clothing sales</td></b>
<td width="80"> <Center><b><font color="blue">Tax textile sales</td></b></font>
<td width="80"> <Center><b><font color="red">Furniture Sales</td></b></font>
<td width="80"> <Center><b><font color="green">Elec/Mech Appl/Fixture Sales</td></font> </b>
<td width="80"> <Center><b> Shoe Sales</td></b>
<td width="80"> <Center><b><font color="blue">Wares Sales</td></b></font>
<td width="80"> <Center><b><font color="red">Total Discounts</td></b></font>
<td width="80"> <Center><b><font color="green">Taxable Income</td></font> </b>
<td width="80"> <Center><b>Tax Amount</td></b>
<td width="80"> <Center><b><font color="blue">Credit Total</td></b></font>
<td width="80"> <Center><b><font color="red">Payout Total</td></b></font>
<td width="80"> <Center><b><font color="green">Actual Deposit</td></font> </b>
<td width="80"> <Center><b>MC/VISA Sales</td></b>
<td width="80"> <Center><b><font color="blue">AMEX Sales</td></b>
<td width="80"> <Center><b><font color="red">Gift Certificates</td></b>
<td width="80"> <Center><b>Customer Count</td></b>
<td width="80"> <Center><b>Total Donations</td></b></font></Center>
</tr>|
While Not(ne Is Nothing)
Set doc = ne.Document
Call doc.ReplaceItemValue("exported" , "yes")
Call doc.Save(True, False)
Print|<tr> <td>| + ne.ColumnValues(0) + |</td> | 'Store Name
Print|<td> | + ne.ColumnValues(1) + | </td> | 'Date
Print|<td> | + ne.ColumnValues(2) + | </td> | 'Non Tax Clothing Sales
Print|<td> <font color="blue">| + ne.ColumnValues(3) + | </font> </td> | 'Taxable Textile Sales
Print|<td> <font color="red">| + ne.ColumnValues(4) + | </font> </td> | 'Furniture Sales
Print|<td> <font color="green">| + ne.ColumnValues(5) + | </font> </td> | 'Elec/Mech Appliance/Fixture Sales
Print|<td> | + ne.ColumnValues(6) + | </td> | 'Shoe Sales
Print|<td> <font color="blue">| + ne.ColumnValues(7) + | </font> </td> | 'Wares Sales
Print|<td> <font color="red">| + ne.ColumnValues(8) + | </font> </td> | 'Total Discounts
Print|<td> <font color="green">| + ne.ColumnValues(9) + | </font> </td> | 'Taxable Income
Print|<td> | + ne.ColumnValues(10) + | </td> | 'Tax Amount
Print|<td> <font color="blue">| + ne.ColumnValues(11) + | </font> </td> | 'Credit Total
Print|<td> <font color="red">| + ne.ColumnValues(12) + | </font> </td> | 'Payout Total
Print|<td> <font color="green">| + ne.ColumnValues(13) + | </font> </td> | 'Actural Deposits
Print|<td> | + ne.ColumnValues(14) + | </td> | 'MC/VISA Sales
Print|<td> <font color="blue">| + ne.ColumnValues(15) + | </font> </td> | 'AMEX Sales
Print|<td> <font color="red">| + ne.ColumnValues(16) + | </font> </td> | 'Gift Certificates
Print|<td> <font color="red">| + ne.ColumnValues(17) + | </font> </td> | 'Customer Count
Print|<td> <font color="red">| + ne.ColumnValues(18) + | </font> </td> | 'Total Donations
Set ne = nv.GetNext(ne)
Wend
End Sub

Add after the code line
Set qs = db.GetView("Export")
the line
qs.AutoUpdate = False
Your view navigator gets confused when documents get discarded from view while navigator tries to get from entry to entry. qs.AutoUpdate = False prevents all entries in view during agent run.

Related

HtmlAgilityPack Scrape table from website

I am learning how to use HtmlAgilityPack and I cannot find any documentation on scraping tables in the way I need.
My table looks like this
| | NAME | PRICE | TIME |
| --- | ------------------------------------- | ---------------- | --------- |
| | Arma 3 | $29.99 | 1586h 57m |
| | DayZ | $44.99 | 28h 05m |
| | Survarium | Free or No Price | 02h 25m |
| | Squad | $49.99 | 11h 05m |
| | Squad - Public Testing | Not in store | 0h 0m |
| | Counter-Strike: Global Offensive | Free or No Price | 00h 26m |
| | Infestation: Survivor Stories Classic | Free or No Price | 00h 05m |
| | PLAYERUNKNOWN'S BATTLEGROUNDS | $29.99 | 0h 0m |
I have tried many things found on Google regarding tables and HtmlAgilityPack but none have worked.
I have a listview that I want the data to go into. The only things I want are
gname, gprice, gtime loaded to the listview and remembering that these values change depending on the games listed.
I can't post what I've already tried as there would be to many website posts to go back through and find.
The html for the table on the website is this
<div class="col-12">
<h2>Dan Andrews Steam Profile 8 Games</h2>
<div class="table-responsive">
<table class="table game-table">
<tbody>
<tr>
<th></th>
<th class="gname">NAME</th>
<th style="width:200px">PRICE</th>
<th style="width:200px">TIME</th>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/107410/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">Arma 3</td>
<td class="gprice">$29.99</td>
<td class="gtime">1586h 57m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/221100/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">DayZ</td>
<td class="gprice">$44.99</td>
<td class="gtime">28h 05m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/355840/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">Survarium</td>
<td class="gprice">Free or No Price</td>
<td class="gtime">02h 25m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/393380/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">Squad</td>
<td class="gprice">$49.99</td>
<td class="gtime">11h 05m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/774941/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">Squad - Public Testing</td>
<td class="gprice">Not in store</td>
<td class="gtime">0h 0m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/730/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">Counter-Strike: Global Offensive</td>
<td class="gprice">Free or No Price</td>
<td class="gtime">00h 26m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/226700/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">Infestation: Survivor Stories Classic</td>
<td class="gprice">Free or No Price</td>
<td class="gtime">00h 05m</td>
</tr>
<tr>
<td class="gicon"><img src="https://cdn.cloudflare.steamstatic.com/steam/apps/578080/capsule_184x69.jpg" onerror="this.src='/assets/images/applogo.svg'">
</td>
<td class="gname">PLAYERUNKNOWN'S BATTLEGROUNDS</td>
<td class="gprice">$29.99</td>
<td class="gtime">0h 0m</td>
</tr>
</tbody>
</table>
</div>
</div>
```
Here is a possible solution in C# (even though the question is tagged with VB.Net). You get a list of Game objects here. And you can then bind these to a ListView or whatever you may need.
public class Game
{
public string Img { get; set; }
public string Name { get; set; }
public double? Price { get; set; }
public string? PriceStatus { get; set; }
public TimeSpan? Time { get; set; }
}
public static void Go()
{
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(File.ReadAllText(htmlFilePath));
Regex timeRegex = new Regex(#"\b(\d+)h\b\s*\b(\d+)m\b", RegexOptions.Compiled);
Regex priceRegex = new Regex(#"\b\$?(\d+\.\d\d)\b", RegexOptions.Compiled);
List<Game> gamesList =
doc.DocumentNode.SelectNodes("//table[#class='table game-table']/tbody/tr")
.Select(tr => tr.SelectNodes("td")?.ToList())
.Where(tds => tds != null && tds.Any())
.Select(
(tds) =>
{
return
new
{
Img = tds[0].SelectSingleNode("img").Attributes["src"].Value,
Name = tds[1].InnerText,
PriceString = tds[2].InnerText,
PriceMatch = priceRegex.Match(tds[2].InnerText),
TimeString = tds[3].InnerText,
TimeMatch = timeRegex.Match(tds[3].InnerText),
};
})
.Select(
(v) =>
{
Game game =
new Game
{
Img = v.Img,
Name = v.Name,
};
//Set Price
if (v.PriceMatch.Success)
{
game.Price = double.Parse(v.PriceMatch.Groups[1].Value);
game.PriceStatus = "In Store";
}
else
{
game.PriceStatus = v.PriceString;
}
//Set Time
if (v.TimeMatch.Success)
{
int hours = int.Parse(v.TimeMatch.Groups[1].Value);
int minutes = int.Parse(v.TimeMatch.Groups[2].Value);
game.Time = new TimeSpan(hours, minutes, 0);
}
return game;
})
.ToList();
}

Storing information from td tags with a specific width, in python

I am trying to store all the information from the td tags that have width="82" or maybe there is a more efficient method.
<a name="AAKER"> </a>
<table border="" width="100%" cellpadding="5"><tbody><tr><td bgcolor="#FFFFFF"><b>AAKER</b>
<small>(<a href="http://google.com">Soundex
A260</a>)
— <i>See also</i>
ACKER,
KEAR,
TAAKE.
</small>
</td></tr></tbody></table><br clear="all">
<table align="left" cellpadding="5">
<tbody><tr><td width="82" align="right" valign="top"> </td><td valign="top">
<img src="rd.gif" width="13" height="13">
<b><a name="954.35.65">Aaker, Casper Drengman</a> (b.1883)</b>
— also known as
<b>Casper D. Aaker</b> — of Minot,
WardCounty , N.Dak. Born in Ridgeway,
Winneshiek County , Iowa, August,
1883. Republican.
Lawyer; organizer, Trinity
Hospital,
1922; delegate to Republican National Convention from North Dakota.
<table width="100%" align="left">
<tbody>
<tr><td width="20"> </td>
<td width="26" valign="top"><img src="hand.gif" width="26" height="17"></td>
<td valign="top">
<span style="font-size:8pt;"><i>Relatives:</i>
Son of Drengman Aaker and Christine (Ellefson) Aaker; married,
December 15, 1914,
to Leda Mansfield.</span>
</td>
</tr>
</tbody>
</table>
</td></tr>
<tr><td width="82" align="right" valign="top"> </td>
<td valign="top"><img src="rd.gif" width="13" height="13">
<b><a name="949.93.45">Aaker, H. H.</a></b> — of
Norman County
, Minn. Prohibition candidate for
secretary of state of Minnesota
, 1892.
Burial location unknown.
</td></tr>
</tbody>
</table><br clear="all"><br>
<a name="AALL"> </a>
<table border="" width="100%" cellpadding="5">
<tbody><tr><td bgcolor="#FFFFFF"><b>AALL</b> <small>(
SoundexA400
)— <i>See also</i>
AHL,
AL,
ALL,
</small>
</td></tr>
</tbody></table><br clear="all">
<tbody><tr><td width="82" align="right" valign="top"> </td>
<td valign="top"><img src="rd.gif" width="13" height="13">
<b><a name="961.32.34">Aamodt, Gary</a></b> — of Madison,
Dane County, Wis.
Democrat. Delegate to Democratic National Convention from Wisconsin,
1976. Still living as of 1976.
</td></tr>
<tr><td width="82" align="right" valign="top"> </td>
<td valign="top"><img src="rd.gif" width="13" height="13">
<b><a name="030.75.75">Aamodt, Marjorie M.</a></b> —
Democrat. Candidate for
<a href="http://google.com">Pennsylvania
state house of representatives</a> 13th District, 1980.
Female.
Still living as of 1980.
</td>
</tr>
</tbody></table><br clear="all"><br>
So far I have tried defining an object:
ta = driver.find_element_by_tag_name('tbody').get_attribute('innerHTML')
pd.read_html(ta)
But I wish to have all pd.read_html(ta)[i] stored in a dataframe ignoring the table width ="100"
You can .extract() the tables with widht="100% from the soup and then get all rows.
For example (txt contains your HTML snippet from the question):
soup = BeautifulSoup(txt, 'html.parser')
for t in soup.select('table[width="100%"]'):
t.extract()
all_data = []
for row in soup.select('tr'):
name, desc = row.get_text(strip=True, separator=' ').split('—', maxsplit=1)
all_data.append([name, desc.strip()])
df = pd.DataFrame(all_data, columns=['name', 'description'])
print(df)
df.to_csv('data.csv')
Prints:
name description
0 Aaker, Casper Drengman (b.1883) also known as Casper D. Aaker — of Minot, Ward...
1 Aaker, H. H. of Norman County , Minn. Prohibition candidate...
2 Aamodt, Gary of Madison, Dane County , Wis.\n Democr...
3 Aamodt, Marjorie M. Democrat. Candidate for Pennsylvania\n ...
And saves data.csv (screenshot from LibreOffice):

SQL query for dynamic table column selection from checkbox in codeigniter?

I am trying to retrieve the columns from the database based on checkbox selection in codeigniter. But I have no idea how to do it?
For example there's a columns in a database table Member:
| ID | Name | Gender | Status |
---------------------------------------
| 1 | Anne | F | Member |
| 2 | Brown | M | Member |
| 3 | Carl | M | Member |
Then there's checkboxes in the data.php view to select which column to display
<?php echo form_open(data/getData);?>
<label class="col-md-4" for="parameter">Parameter</label>
<div class="col-md-6">
<input type="checkbox" id="parameter" value="name"> Name <br>
<input type="checkbox" id="parameter" value="gender"> Gender <br>
<input type="checkbox" id="parameter" value="status"> status <br>
</div>
<input type="submit" class="btn btn-md btn-info" value="Process" />
<?php echo form_close();?>
<div class="well">
<table class="table table-bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr class="info">
<th>ID</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($query as $d): ?>
<tr>
<td><?php echo $d['ID'];?></td>
<td><?php echo $d[''];?></td>
<td><?php echo $d[''];?></td>
<td><?php echo $d[''];?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
How to dynamically make the column name retrieved from the checkbox?
Data_model.php:
function getData(){
//I don't know how to get the dynamic column select from the view to the select query
$this->db->select(?);
$this->db->from('member');
$query = $this->db->get();
return $query->result();
}
Anyone help me with this please?
Try this simple approach , make a POST/GET with a name attribute param[] an array
<input type="checkbox" id="parameter" name="param[]" value="name"> Name <br>
<input type="checkbox" id="parameter" name="param[]" value="gender"> Gender <br>
<input type="checkbox" id="parameter" name="param[]" value="status"> status <br>
in PHP (assuming post value)
$param = $this->input->post('param');
//if no param get all columns
if(empty($param)){
$param = '*';
}else{
//if array value is more than 1 use implode else just take the 1st array
$param = (count($param) > 1 ) ? implode(',', $param) : $param[0]; //make a single string and concatenate them with ,
}
example output: name,status
then use $param in your model like this $this->db->select("$param");

Difficulty Finding Table CheckBoxes

I'm trying to use Excel VBA to perform a very manual process in IE. I've worked with VBA and IE enough to do easy tasks like enter text into fields or interact with buttons, but I'm having a difficult time wrapping my head around this.
I have a list of fields in Excel: First Name, Last Name, Email Address. There are over two thousand rows of information in the spreadsheet. The website I'm working with has a list of over three thousand rows of information (same information with the addition of a checkbox), except it only loads a maximum of 100 rows at a time. Every row of data in Excel exists in the web tool.
I'd like to have my procedure iterate over the names and check the corresponding row on the webpage. The problem is figuring out how to identify the input id for the corresponding checkbox. I'm not very familiar with HTML so my code is very rudimentary... I've spent much of the day writing this:
Sub Test()
Dim str As String
Dim ie As SHDocVw.InternetExplorer
Dim doc As HTMLDocument
Dim tbls As Object
Dim tbl As Object
Dim trow As Object
Dim trs As Object
Dim Cell As Range
Set ie = New SHDocVw.InternetExplorer
ie.navigate "https://test.com"
ie.Visible = True
Set doc = ie.Document
Set tbls = doc.getElementsByTagName("TABLE")
For Each Cell In Range("A2:A2200")
For Each tbl In tbls
For Each trow In tbl.Rows
If InStr(1, trow.Cells(i).innerText, Cell.Offset(0, 1) & ", " & Cell) > 0 Then
Debug.Print trow.Cells(0).innerText
Stop
End If
Next trow
Next tbl
Next Cell
End Sub
The above code is able to identify the cell on the page that matches the cell in the workbook, but I can't figure out how to find the id to the associated checkbox. The site is private, so I can't provide a link. See below for what appears to be the relevant piece of source code for the site:
<div>
<table cellspacing="0" border="0" id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults" style="border-color:Black;border-width:1px;border-style:Solid;width:100%;border-collapse:collapse;">
<tr>
<td colspan="6">
<table id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_tabPager" border="0" cellpadding="5" width="100%">
<tr>
<td style="border-style:none;">
<a id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_lbPrev" disabled="disabled">Previous</a>
<a id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_lbNext" disabled="disabled">Next</a>
</td>
<td style="border-style:none;" align="right">
<b>Showing:</b>
<span id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow"><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_0" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="10" checked="checked" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_0">10 People</label><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_1" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="25" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow$1\',\'\')', 0)" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_1">25 People</label><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_2" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="50" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow$2\',\'\')', 0)" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_2">50 People</label><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_3" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="100" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow$3\',\'\')', 0)" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_3">100 People</label></span>
</td>
</tr>
<tr id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_trSelectOptions">
<td colspan="2" style="border-style: none;" align="left">
Select All on Page
Clear All on Page
<a class="link_w_img" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$ctl09", "", true, "", "", false, true))">
<img src="/images/all.gif" />
<span>Select Entire List</span></a>
<a class="link_w_img" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$ctl11", "", true, "", "", false, true))">
<img src="/images/none.gif" />
<span>Clear Entire List</span></a>
</td>
</tr>
</table>
</td>
</tr>
<tr class="gridheader" align="left">
<th scope="col">Select</th>
<th scope="col">Last Name</th>
<th scope="col">First Name</th>
<th scope="col">Middle Name</th>
<th scope="col">E-mail Address</th>
<th scope="col" style="width:0px;"> </th>
</tr>
<tr class="griditem" align="center">
<td>
<input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_SelectCheckBox" type="checkbox" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl03$SelectCheckBox" />
</td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();">Demo1</td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();">Test</td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();"> </td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();">Demo1#Test.com</td>
<td style="width:0px;">
<div id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip" class="popup">
<div class="popupbg">
<table>
<tr>
<td style="vertical-align:top;">
<span id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_lblName" style="font-weight:bold;">Demo1, Test </span>
<br />E-mail:<span id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_lblEmail">Demo1#Test.com</span><br />
<table cellspacing="0" border="0" id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_dgDemos" style="border-style:None;border-collapse:collapse;margin-top:-1.25em;">
<tr>
<td>
</td><td>
</td>
</tr><tr>
<td>
Employee ID:
</td><td>
N/A
</td>
</tr><tr>
<td>
Job Title:
</td><td>
N/A
</td>
</tr><tr>
<td>
Location:
</td><td>
N/A
</td>
</tr>
</table>
</td>
<td style="width:50px;vertical-align:top;">
<img src="/images/user_popup.jpg" border="0" width="48" height="48"/>
</td>
</tr>
</table>
</div>
</div>
</td>
In the above example, the Last Name is Demo1, the First Name is Test, and the Email is Demo1#Test.com, and the input id for the checkbox is ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_SelectCheckBox.
My question is, how do I identify the input id after I've identified table row? Or, perhaps that's impossible and I'm going about this the wrong way? Any thoughts will be much appreciated.
Edit
This is what I tried that gives me the Runtime error (Object variable or With block variable not set):
trow.Cells(0).getElementsByTagName("input")(0).Click
I also tried this:
set input = trow.Cells(0).getElementsByTagName("input")(0)
input.Click
And finally, both these produce the same error:
Debug.Print trow.Cells(0).getElementsByTagName("input")(0).innerText
Debug.Print trow.Cells(0).getElementsByTagName("input")(0)
This is the output of the Debug.Print in my original code:
Demo1, Test
E-mail: Demo1#Test.com
Employee ID: N/A
Job Title: N/A
Location: N/A
The only pieces I care about (in the output) are the first two lines, the email and name of the individual.
This test worked for me. Looks like the rows you want all have class="griditem", so you can check all table rows for that class name. When you find a match on that and on your cell values, you should be able to find the checkbox as shown.
Sub Tester()
Dim d As New HTMLDocument, trs, rw
d.body.innerHTML = _
"<section><table><tr class='griditem'><td>" & _
"<input type='checkbox' id='id_1'></td>" & _
"<td>Foo</td></tr><tr class='griditem'><td>" & _
"<input type='checkbox' id='id_2'></td>" & _
"<td>Bar</td></tr></table></section>"
Set trs = d.getElementsByTagName("tr")
For Each rw In trs
If rw.className = "griditem" Then
'check cell values for match....
Debug.Print rw.Cells(0).getElementsByTagName("input")(0).ID
End If
Next rw
End Sub
Give a try to this.
Set ElementCol = ie.Document.getElementsByTagName("input")
For Each btnInput In ElementCol
'your code here
Next btnInput

use drop down value to run query without submit

<form name = "rsPass" action="<%= pagePath %><%= jspPageName %>.jsp?callrspassthru=true" method="post">
<table cellpadding="0" cellspacing="0" width="640">
<tr>
<td class="wizardHeader" width="100%" style="height: 21px;"> FCAT Scores by Teacher by Course with Gains and Years Growth</td>
</tr>
<tr>
<td class="wizardInstruction" style="padding-top: 10px; padding-right: 30px; padding-left: 30px; height=33px;"valign="top">
<br>
This report will list all teachers, courses, and student's FCAT scores with gains.
<br><br>
</td>
</tr>
<tr>
<td width="100%" height="2" background="images/hr.gif"><IMG height="2" src="images/hr.gif"></td>
</tr>
<table width="700">
<tr>
<td class="detailFormColumn"><br>
<label>Active or Inactive Teachers: </label><br>
<select name="active">
<option value=""> Select <br> </option>
<option value="IS NULL"> Active <br> </option>
<option value="IS NOT NULL">Inactive <br> </option>
</select>
</td>
</tr>
First letter of teacher's last name:
<%
out.println(request.getParameter("active"));
// both of these values are NULL as if they are not being read when the drop down is selected above
Statement db1 = con.createStatement();
int newRecords1 = 0;
SQL1 = " SELECT DISTINCT substring(i.lastName, 1, 1) as grade " +
" FROM employmentAssignment e with(nolock) " +
" JOIN calendar c with(nolock) on c.schoolID = e.schoolID " +
" JOIN person p with(nolock) on p.personID = e.personID " +
" JOIN [identity] i with(nolock) on i.identityID = p.currentIdentityID and i.personID = p.personID " +
" WHERE c.calendarID = " + calID + "" +
" AND e.enddate is " + request.getParameter("active") + "" +
" AND e.teacher = 1 " +
" ORDER BY substring(i.lastName, 1, 1) ";
result1 = db1.executeQuery(SQL1);
out.println("<select name=grade id=15 onchange='loadStudents()'><option value='NULL' selected='true'>Select</option>");
while(result1.next()) { grade=result1.getString(1); out.println("<option value='"+grade+"'>"+grade+"</option>");}
out.println("</select>");
con.close();
%>