I am using the education iSAMS software to produce a report, then export that data to Excel. Almost everything is written in Classic ASP, and it's a 2-frame window, containing Student IDs on the left frame, and a report for each student ID on the right frame. Click on a student of the left, and the report shows in the right pane.
The report uses the Student ID as a parameter :
paramBuilder.NextParameter(intID)
... and this works fine and produces the report from the SQL loop.
However, I'm unable to use the parameter in the Excel export part (I get the error "syntax error or access violation"). If I remove the parameter from the WHERE clause, the export works (although it exports all Student IDs, not just the one).
I've tried just about everything I can think of, but I still hit a brick wall. Is it possible to re-use this parameter in the export?
Thanks in advance.
Here is the code :
<!--#include file="../../system/includes/inc_security.asp"-->
<!--#include file="../../system/includes/inc_theme.asp"-->
<% 'viewstudent-test.asp-v111-11-09-2017 --Includes Export to Excel
'txtModule="iSAMS_SCHOOLDIRECTORY"
'txtContext="SDSTUDENT"
intID = request.querystring("id")
%>
<!--- SHOW THE SUBJECT REPORTS --->
<table border="1px" width="100%">
<tr>
<td>Subject</td>
<td>Subject Report</td>
</tr>
<%
sql = "SELECT DISTINCT txtSchoolID, txtID, txtCommentID, txtComment FROM CAN_Tbl_UCAS_Reports WHERE intReportType = 1 AND txtSchoolID = " & paramBuilder.NextParameter(intID) & " ORDER BY txtID"
Set rsRecord = Database.GetRs(sql, conn, paramBuilder.Parameters)
if not rsRecord.EOF then
do until rsRecord.EOF
' First we need to create our Variables
SchoolID = rsRecord("txtSchoolID")
ConID = rsRecord("txtCommentID")
Com = rsRecord("txtComment")
%>
<tr>
<td style="text-align:center; vertical-align:top; height:10px"><%Response.Write(rsRecord.Fields("txtID").value)%></td>
<td style="text-align:center">
<form action="updateform.asp" method="post">
<input type="hidden" name="ID" value="<%=ConID%>" />
<input type="hidden" name="SchoolID" value="<%=SchoolID%>" />
<textarea rows="3" cols="180" name="comment"><%=Com%></textarea>
</form>
<td>
</tr>
<%
rsRecord.Movenext
loop
end if
rsRecord.close
set rsRecord = nothing
%>
</table>
<%If Request("ACT")="xls" Then
'Build & Execute Your SQL Command
SQL = "SELECT DISTINCT txtSchoolID, txtID, SubjectTeacher, txtComment FROM CAN_Tbl_UCAS_Reports WHERE intReportType = 1 AND txtSchoolID = '" & intID & "' ORDER BY txtID"
Set rstSearch = conn.Execute(SQL)
'Set the HTTP Header
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=""Excel Export.xls"""
'Output Table %>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>Header 1</th><th>Header 2</th><th>Header 3</th>
</tr><% Do While Not rstSearch.EOF %>
<tr>
<td><%=rstSearch(1)%></td><td><%=rstSearch(3)%></td>
</tr>
<% rstSearch.MoveNext : Loop %>
</table>
<%
'Stop Processing Page Now
Response.End
End If
%>
<form action="?" method="post">
<input type="hidden" name="ACT" value="xls">
<input type="submit" value="Export To Excel">
</form>
</body>
</html>
<!--#include file="../../system/connections/inc_dbconnclose.asp"-->
Related
I trying to submit items in a shopping cart to a database table but I can't get a clear understanding or how to implement it using the documentation on WTFORMS and other online materials I came across.
I have this forms in my forms.py:
class CartForm(Form):
amount = IntegerField('Price')
item_name = StringField('Product Name')
quantity = IntegerField('Quantity')
item_total_amount = IntegerField('Item Total')
class MainForm(FlaskForm):
total_amount = IntegerField('Total Amount')
cart_items = FieldList(
FormField(CartForm),
min_entries=1,
max_entries=20)
and this is the form in my template:
checkout.html
<form name="cart" action="{{ url_for('posts.checkout') }}" method="post"
enctype="multipart/form-data">
<table class="timetable_sub">
<thead>
<tr>
<th>Product Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{% for item in user_cart %}
</tr>
<tr name="line_items">
<td><input type="text" name="item_name " value="{{item.item_name }}"></td>
<td><input type="number" name="quantity " value="{{item.quantity}}"></td>
<td><input type="number" name="amount" value="{{item.amount}}"></td>
<td>
<input type="number" name="item_total_amount "value="item_total_amount
</td>
</tr>
{% endfor %}
</tbody></table>
<input type="number" name="total_amount" value="total_amount">
<input type="submit" value="Register">
</form>
I will appreciate a tutorial link or code base that can help me send this looped for fields to the database table
Given the HTML snippet below how can I, using page-object field accessors, get the second input field, the one with id="333:".
I can't use the id to identify the field as it's auto-generated.
Using page-object accessors I can get the embedded table and the correct cell but the cell object is a PageObject::Elements::TableCell which doesn't seem to have any methods that allow access to the embedded span and input field.
I can get the input field using native Watir accessors - i.e., browser.div( ... etc ...) but would prefer to use just page-object accessors if possible.
If not possible then I'll live with native Watir. Thanks
<div class="modalContent">
<table role="presentation" id="324:_layoutTbl" class="axial">
<tbody>
<tr>
<td>
<input id="326:" name="" value="" onchange="juic.fire("326:","_change",event);" onfocus="juic.fire("326:","_focus",event);" onblur="juic.fire("326:","_blur",event);" type="text">
</td>
</tr>
<tr>
<td class="sfTH">
<label for="332:">Users:</label>
</td>
<td>
<table class="noborder" role="presentation">
<tbody>
<tr>
<th>
<label id="336:" class="rcmFormLabel">Hiring Manager</label>
<label id="337:" for="333:" class="rcmFormLabe">Users, Hiring Manager</label>
</th>
<td><span class="autocompspan ">
<input class="autocompinput" id="333:" name="333:" onfocus="juic.fire("333:","_focus",event);" size="20" value="Bill Murray" role="combobox" type="text">
<input value="111111" id="333:_hidden" name="333:_hidden" type="hidden">
</span>
<div id="335:" style="display:none"><img alt="" class="globalFloatLeft">
<div id="335:_error" style="color:#ff0000">undefined is required</div>
<div style="clear:both;"></div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
After more experimenting I found the answer to my question. I declared the table accessor, e.g., div(:my_table, :class => 'modalContent').table.table then in the code, to get the input field in the first row I did my_text_field = my_table_element[0].text_field_element which returned the PageObject::TextField object in column 2 of row 1
We have an application in Classic ASP(Active Server Pages)
We have following source code to Export a data to Excel
<% Response.ContentType="application/vnd.ms-excel"
sqlString = Trim(Request("hiddensqlstring"))
If sqlString <> "" then
set result = cn.execute(sqlString)
%>
<table border="1" style="width:300px;" align="center">
<tr>
<td align="left">ContractNo</b></td>
<td align="left">TotalNo</td>
</tr>
<% do while not result.EOF %>
<tr>
<td align="left"><%=result("ContractNo")%></td>
<td align="right"><%=result("TotalNo")%></td>
</tr>
<% result.MoveNext
loop
%>
</table>
<%Else
Response.Write("<BR> <BR> <P ALIGN=CENTER CLASS=PAGETITLE> Error </P>")
End If%>
After exporting the values the value of ContractNo which has to be "12345.678901.0100" is getting exported as "123,456,789,010,100" or sometimes "12,34,56,78,90,10,100". especially on systems where Excel is configured with Portuguese language.
Is there any settings or format changes that I have to make?
Change
<td align="left"><%=result("ContractNo")%></td>
To
<td align="left">=<%=result("ContractNo")%></td>
The = tells excel not to try and change the format and treat it as a set value
I have this code :
<tbody id="frm:r:0:s:tbody_element">
<tr>
<td>
<img id="frm:r:0:s:0:img_2" src="/example/img/ic_small_min.gif"
onclick="Expand(getID(this.id,'f'))" style="cursor: pointer;" />
- My Items
<span id="frm:r:0:s:0:f" style="DISPLAY: none;">
<input type="checkbox" name="frm:r:0:s:0:bcb" id="frm:r:0:s:0:bcb"
value="true" onclick="checkAll(this.form, this)" />
<table id="frm:r:0:s:0:mcb">
<tr><td><label><input type="checkbox" name="frm:r:0:s:0:mcb"
value="H321" /> List</label></td>
</tr>
<tr><td>
<label><input type="checkbox" name="frm:r:0:s:0:mcb"
value="H318" /> Edit</label></td>
</tr>
<tr><td><label><input type="checkbox" name="frm:r:0:s:0:mcb"
value="H310" /> Delete</label>
</td></tr>
But I try to getElementsbyid("frm:r:0:s:tbody_element").innerText and I get :
My items List Edit Delete
Instead of only the
My items
why?
What I want to do is get only the : My Items
I don't want to get all the text inside the element.
'if doc = the loaded document
Set tb = doc.getElementById("frm:r:0:s:tbody_element")
Set els = tb.getElementsByTagName("td")(0).ChildNodes
Debug.Print els(1).NodeValue ' "- My Items"
My employer is switching their internal portal over to SharePoint. One of the highly used features of the previous portal was a 'people search' that allowed partial names. SharePoint 2007 defaults to keyword searches which only match against the exact word(s) given as search terms. It can do full-text searches but you have to provide the property name, e.g. "FirstName:tom" (without the quotes of course). That works for a programmatic solution but not for end users.
Is there a way in SharePoint 2007 to let users search for people using partial names?
I found this solution that works well enough for us.
Add a ContentEditor web part to the target page and go to the HTML editor button. Add the following HTML code. It creates two input fields (firstname/lastname) and then creates a query with the search terms included as property searches which will invoke the full-text search.
Note: you need to replace the search result page with the appropriate location for your configuration.
<script language="javascript">
//function to handle enter on keyboard
function txtWildPeopleFinder_KeyDown(e)
{
if (e.keyCode == 13 || e.keyCode==10)
{
e.returnValue=false;
DoWildPeopleSearch();
return false;
}
else
return true;
}
//escape apostrophes in search strings
function escapestr(str)
{
return str.replace("'","%22");
}
//search function
function DoWildPeopleSearch()
{
var firstname = escapestr(document.all["firstname"].value);
var lastname = escapestr(document.all["lastname"].value);
var url;
//search on last name
if(firstname == "")
{
url = "/searchcenter/Pages/peopleresults.aspx?k=LastName%3A" + lastname;
window.location=url;
return;
}
//search on first name
if(lastname == "")
{
url = "/searchcenter/Pages/peopleresults.aspx?k=FirstName%3A" + firstname;
window.location=url;
return;
}
//first and last
url = "/searchcenter/Pages/peopleresults.aspx?k=lastname%3A" + lastname + "%20FirstName%3A" + firstname;
window.location=url;
return;
}
</script>
<table cellpadding="2" cellspacing="0" border="0" width="100%" ID="Table3">
<tr>
<td width="80" nowrap>
First Name:
</td>
<td width="100%">
<input size="20" maxlength="100" id="firstname" name="firstname" type="text" onkeydown="txtWildPeopleFinder_KeyDown(event)">
</td>
</tr>
<tr>
<td width="80" nowrap>
Last Name:
</td>
<td>
<input size="20" maxlength="100" id="lastname" name="lastname" type="text" onkeydown="txtWildPeopleFinder_KeyDown(event)">
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="button" onclick="DoWildPeopleSearch()" value="Search">
</td>
</tr>
</table>