first two numbers after the decimal point - html

I am a PLC programmer, not a .ASP guy, and don’t know how to write the code for getting the result I need. I have a PLC tag I read for my web display, but I would like to show only the first two numbers after the decimal point. I don’t know if I can format the body to do that.
This is my code:
<td align="left" height="24" style="width: 262px"><b>NF1:<% ReadLogixTagUnconnecte("1,0","NF1_FT14101", "REAL");%>GPM</b></td>
This is how it displays now: NF1:15.2013
This is what I will like to have: NF1:15.20
I tried the following but it will not even show a value:
<td align="left" height="24" style="width: 262px"><b>NF1:<% ReadLogixTagUnconnected("1,0","NF1_FT14101", "REAL");%>.TOSTRING(0.00)>GPM</b></td>

EDITED 2
This is for classic asp:
<td align="left" height="24" style="width: 262px"><b>NF1:<% FormatNumber(ReadLogixTagUnconnected("1,0","NF1_FT14101", "REAL"), 2); %>GPM</b></td>
Please post it at the right place next time
EDITED:
Try
<td align="left" height="24" style="width: 262px"><b>NF1:<% Response.Write(string.Format("{0:N2}", ReadLogixTagUnconnected("1,0","NF1_FT14101", "REAL")));%>GPM</b></td>
For more info about numeric formatting: http://msdn.microsoft.com/en-us/library/0c899ak8(v=vs.110).aspx
Format string: http://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx

Related

HTML Scraping with HTMLReader Search for Table Row Content and Return href

using Objective-C HTMLReader for my first (simple, I think) HTML scraping task. But there's little documentation with it, and after a lot of experimentation, can't quite get what I need.
I'm scraping an old HTML page whose largest feature is one table with three columns and many rows. Here's a sample of the table with one row:
<table border="1" cellspacing="2" cellpadding="6" bordercolor="#000000" bgcolor="#999999" style="margin-top:50px;width:100%;">
<tr height=30>
<td bgcolor="#34003C" align="left" valign="middle" background="background.gif"><span class="cls_TableHeader">Bands</span></td>
<td bgcolor="#34003C" align="left" valign="middle" background="background.gif"><span class="cls_TableHeader">Style</span></td>
<td bgcolor="#34003C" align="left" valign="middle" background="background.gif"><span class="cls_TableHeader">Country</span></td>
</tr>
<tr>
<td class="cls_tdDisco0" align="left" valign="middle">
<strong>THE BEATLES</strong>
</td>
<td class="cls_tdDisco0" align="left" valign="middle">
<span class="cls_DiscoText">Rock</span></td>
<td class="cls_tdDisco0" align="left" valign="middle"><span class="cls_DiscoText">England</span></td>
</tr>
there are, of course, many rows.
What I'm trying to accomplish:
I need to search for the td that contains "THE BEATLES", and extract the href attached to it (of course, even when it's contained in the middle of a lot of other rows)
What I've tried:
I can get the table itself with
HTMLDocument *home = [HTMLDocument documentWithData:data contentTypeHeader:nil];
HTMLElement *table = [home firstNodeMatchingSelector:#"TABLE"];
HTMLNode *theActualTable =[table childAtIndex:1];
but I can't really use the method "nodesMatchingSelector" to search rows since what I'm looking for isn't a selector. I've tried getting the rows (via children), but then I'm looking at iterating through each row's children of children until I drill to the tag that contains THE BEATLES and then using that index to get the a tag attached to that? It seems that there should be a much easier way to do this with HTMLReader. I feel like I'm missing something simple.
Thanks in advance!
Here is some psuedo code that might work for you:
Use nodesMatchingSelector to get all the tr in the table
Then loop through all the tr and get the first td of each tr
Then use nodesMatchingSelector again to get the strong tag
Then use node.textContent to get the text content of the strong tag
https://github.com/nolanw/HTMLReader has an example in the readme that shows using the textContent method
feel free to post follow up questions as comments if any of this doesn't make sense

Click correct link in an HTML table

I am working to create a connector app between a client database and an external web system. This will prevent daily double entry of notes to the web page. The external system is an old asp site. I do not have acces to their code. They do not offer an API.
I have all of the connecter app working with the exception of clicking the link associated with the "Notes" that need updating.
Basically, if you picture an HTML table that looks like this:
[3/3/2017][category][ Notes ]
[2/5/2015][category][ correspondence ]
[1/5/2013][category][ records ]
The HTML link is on the date, not on the word "Notes" nor "correspondence", or "records". Some tables have up to 8 rows. The notes row isn't always on top. There is no way to sort it to the top. Since the
I want to click the date link that corresponds to the word "Notes"
I have tried countless regex queries on the underlying HTML code with no luck. Anyone have any suggestions on how I can get this done?
Here is the HTML as requested:
10/26/2016
</td>
<td height="20" align="center" nowrap> Open</td>
<td height="20" align="center" nowrap>10/26/2016</td>
<td height="20" align="center" nowrap></td>
<td height="20" width="331">Notes<br>
</td>
</tr>
<tr >
1/13/2017
<td height="20" align="center" nowrap> Open</td>
<td height="20" align="center" nowrap>10/26/2016</td>
<td height="20" align="center" nowrap></td>
<td height="20" width="331">Correspondence<br>
</td>
</tr>

Selenium IDE XPath: waitForElementNotPresent with not operator doesn't work

I have a problem with a XPath in Selenium IDE.
I have a table where are some records in it. On top of the table headers I have some filtering dropdown menus and a funnel icon, which calls an AJAX function and give's me back the filtered data. Now the problem is, Selenium IDE doesn't recognize when the AJAX call has finished.
Now, when I'm creating the element, I'm looking for it with the following WORKING XPath:
waitForElementPresent
//tr[td/text()='${partyStatus}' and td/text()='${partyLabel}']
When deleting, the status get changed to Inactive. Then i filter for all inactive elements with the same 'partyLabel'.
Then i want to wait for all other elements which are NOT having the actual partyState (inactive) and are not the same partyLabel to not be present
First, I tried this:
waitForElementNotPresent
//tr[td/text()!='${partyStatus}' and td/text()!='${partyLabel}']
This did not work. Then I tried this one, which didn't worked either:
//tr[not(td/text()!='${partyStatus}') and not(td/text()='${partyLabel}')]
Now, I'm stuck here to get this working. How can I wait for the elements to disappear which have the other state and are not the same partyLabel like this one I'm looking for.
Here's an example of one table row:
PartyLabel is first td element and partyStatus is second to last td element.
<tr id="mf:searchAdministrable:0_row_0">
<td style="width:10%">Trader</td>
<td style="width: 2%;"> </td>
<td><span id="mf:searchAdministrable:0:j_idt90">Not Started</span></td>
<td style="width:10%">0570-123456-4</td>
<td style="width: 8%;">142223</td>
<td style="width: 26%;">John Doe #4</td>
<td style="width:15%;"><span id="mf:searchAdministrable:0:j_idt107"><span id="mf:searchAdministrable:0:j_idt107"> United Kingdom</span></span> </td>
<td style="width:8%">SNG</td>
<td style="width:9%;">Inactive</td>
<td style="width: 12%;"><a onclick="mojarra.jsfcljs(document.getElementById('mf'),{'mf:searchAdministrable:0:edit':'mf:searchAdministrable:0:edit'},'');return false" href="#" id="mf:searchAdministrable:0:edit"><img width="16" height="16" src="/skinned/javax.faces.resource/com.csg.jsf.resources.icons/skin/csstandard12/ico_edit_16_cli.gif?conversationContext=j&transactionToken=0.6158652516940941" alt="ico_edit" id="mf:searchAdministrable:0:editIcon"></a><a onclick="mojarra.jsfcljs(document.getElementById('mf'),{'mf:searchAdministrable:0:delete':'mf:searchAdministrable:0:delete'},'');return false" href="#" id="mf:searchAdministrable:0:delete"><img width="16" height="16" src="/skinned/javax.faces.resource/com.csg.jsf.resources.icons/skin/csstandard12/ico_delete_16_cli.gif?conversationContext=j&transactionToken=0.6158652516940941" alt="ico_delete" id="mf:searchAdministrable:0:deleteIcon"></a><a onclick="mojarra.jsfcljs(document.getElementById('mf'),{'mf:searchAdministrable:0:screen':'mf:searchAdministrable:0:screen'},'');return false" title="Screen Transaction Not Started" href="#" id="mf:searchAdministrable:0:screen"><img width="16px" height="16px" src="/images/ico_worldcheck.gif?conversationContext=j&transactionToken=0.6158652516940941" id="mf:searchAdministrable:0:screenIcon"></a></td>
</tr>
The element might still be present within the HTML, but just hidden. Try using waitForVisible and waitForNotVisible instead

Error sending HTML email template using Marketo

I keep getting an error when sending a sample HTML email. I have no idea what the error means and Marketo support is stumped too. I can't send any emails until this is resolved. I have been building HTML email templates for a while now and this is the first time I have come across this.
Here is the error. An error occurred when processing the email Body!
A macro declaration requires at least a name argument near
</table></td><td valign="top" class="spacer" width="20" style
Here is the part of code it is referencing.
</table>
</td>
<td valign="top" name="spacer" class="spacer" width="20" style="border-collapse: collapse;margin: 0;padding: 0;line-height: 1px;mso-line-height-rule:exactly;font-size: 1px;"> </td>
Any help is greatly appreciated.

Trying to get text on same line

OK, another quick question pertaining to this. I took the advice and it works great, my dilemma now is that there is a space between the tables.
I was going to attach a file but I guess I don't have the rep too quite yet.
Anyways, if you can go to http://www.wholesalecabinets.us/Wall-Cabinets_c_524.html, you'll see what I mean. See how the line is close at the tops of the tables and there is a space before the line starts again?
I know, I know... something easy for you guys.
Sorry, I'm a newb and I don't have much HTML experience, but I need some help with a problem.
Currently I have a website that has a bunch of product. I managed to get the products listing to be pretty close to what I want with the exception of one problem, I want the price to be on the same line as the [name] but to the far right. Currently it is under the description to the far right.
Any help is greatly appreciated.
Thanks,
Kevin
<table border="0" cellspacing="0" cellpadding="2" width="95%">
<tr>
<td rowspan="2" align="left" valign="top" class="item" style="width:75px;"><img src="thumbnail.asp?file=[THUMBNAIL]&maxx=50&maxy=50" alt="[name]" border="0" /></td>
<td class="item" align="left" valign="middle"><span class="item">[name]</span><br>
<span class="item">[description]</span></td>
</tr>
<tr>
<td class="item" align="right" valign="top"><span class="price">[ITEMPRICE]</span>   [product_quantity]
<input type="hidden" name="item_id" value="[catalogid]" />
<input type="text" size="2" name="qty-[counter]" value="0" /></td>
</tr>
<img src="assets/templates/[template]/images/div.png" alt="template" vspace="2" width="95%" height="1" />
</table>
Delete these two lines
</tr>
<tr>
You're inserting a new row, when all you want is a new column on the same raw.
You should be able to achieve this by putting the price td in the same row as the name td.
The <tr> elements in your HTML are table rows. What you're looking for are columns. You cannot explicity define columns in HTML (HTML is one dimensional after all) but you can define td (table data) and th (table header) elements inside a row to effectively create a column. If you want your item name, description and price to all be on the same line, they need to be inside the same table row, represented separately as either <td> or <th> elements.