I have to output a table based on value of a variable. I have a unique block of table with variables. Depending on the view there should be a loop the re-read the table.
The variable could have the values Two or Three or both. I have to output the table with view One in all the cases.
Example #1:
Views = "Two, Three"
Output:
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
Example #2:
Views = "Two"
Output:
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
Example #3:
Views = "Three"
Output:
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
Tried to mix some While and For, without success.
<%
i=2
Do While i = 0
%>
<table>
<tr>
<td><% Response.Write i %></td>
</tr>
</table>
<%
i=i-1
Loop
%>
Try this:
<%
Dim Views : Views ="Two" 'Change this to check
Response.write "Initial View =" & Views & "<br/>"
'But "One" will always be printed
If InStr(Views,"One")=0 Then
'add if there is no "One" already
Views = Views & ",One"
End If
Response.write "New View =" & Views & "<br/>"
Dim ArrValues : ArrValues =Array("One","Two","Three")
Dim Counter
For Counter=0 to UBound(ArrValues)
If InStr(Views,ArrValues(Counter))<>0 Then
%>
<table>
<tr>
<td>Table For View <%=ArrValues(Counter)%></td>
</tr>
</table>
<%
'Response.write ArrValues(Counter) & "<br/>"
End If
Next
%>
I think something like this would work fine. I just use if else if. Also I compansated for the case that Views could equal "Two, Three" or "Three, Two".
<%if Views = "Two" then%>
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<%else if Views = "Three"%>
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
<%else if Views = "Two, Three"%>
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
<%else if Views = "Three, Two"%>
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<%end if%>
There are multiple ways to approach this but without changing your code to much, it can be done by splitting your Views variable into an Array using the comma , as a delimiter. Once you have the Array use a For loop to iterate through the Views and use a Select statement to return the correct view.
As you specified that Table One will always be included it has been left outside of the loop.
Something like this (not tested);
<%
Dim item, items
'Build the array from the Views comma separated string
Views = Split(Views, ",")
'Always include Table One
%>
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<%
'Check we have an Array built from the Split().
If IsArray(Views) Then
'How many views have we requested?
items = UBound(Views)
For item = 0 To items
'What view are we current looking at in the loop?
Select Case LCase(Trim(Views(item) & ""))
Case "two"
%>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<%
Case "three"
%>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
<%
End Select
Next
End If
%>
Depending on the complexity of your views you could break each table into it's own Sub procedure or one Sub procedure and call in place of the in-line table definitions. Something like below;
Sub ShowTable(view)
'Keep all in-line table definitions together.
Select Case Trim(LCase(view & ""))
Case "one"
%>
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<%
Case "two"
%>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<%
Case "three"
%>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
<%
End Select
End Sub
In the main loop you would added ShowTable() calls in place of any in-line table code, for example;
<%
Dim item, items
'Build the array from the Views comma separated string
Views = Split(Views, ",")
'Always include Table One
Call ShowTable("one")
'Check we have an Array built from the Split().
If IsArray(Views) Then
'How many views have we requested?
items = UBound(Views)
For item = 0 To items
'What view are we current looking at in the loop?
Call ShowTable(views(item))
Next
End If
%>
Your output will then look something like this (if you pass "Two, Three") for example;
<table>
<tr>
<td>Table For View One</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Two</td>
</tr>
</table>
<table>
<tr>
<td>Table For View Three</td>
</tr>
</table>
Update based on OP feedback
If you don't want multiple tables (which is not clear from your question) then just remove the <table> and </table> in-line definitions (in the ShowTable() procedure), this will create the "guts" of your table (a series of table rows).
Then in the example code above just add <table> at the start and after the code </table>, which will encapsulate your dynamically generated table rows into one table.
<table>
<%
Dim item, items
'Build the array from the Views comma separated string
Views = Split(Views, ",")
'Always include Table One
Call ShowTable("one")
'Check we have an Array built from the Split().
If IsArray(Views) Then
'How many views have we requested?
items = UBound(Views)
For item = 0 To items
'What view are we current looking at in the loop?
Call ShowTable(views(item))
Next
End If
%>
</table>
Your output will then look something like this (if you pass "Two, Three") for example;
<table>
<tr>
<td>Table For View One</td>
</tr>
<tr>
<td>Table For View Two</td>
</tr>
<tr>
<td>Table For View Three</td>
</tr>
</table>
Related
We have a data table in a page and we want screen reader to read that as table. NVDA reads it as a data table by default. But JAWS does not seem to be able to identify the table element and reads the text from left to right row by row without indicating it is a table. I tried adding role="grid" and it did not work. I am wondering if I miss something.
The browser is IE11 and JAWS is 17.0.2727
<table tabindex="0" role="grid">
<thead>
<tr>
<th>Date</th>
<th>Time</th>
<th aria-hidden="true"></th>
<th>Rate</th>
<th>Volume</th>
</tr>
</thead>
<tbody>
<tr>
<td>12/19/16</td>
<td>
<span>10:50:09</span> - <span>12/19/16</span> <span>11:05:09</span>
</td>
<td aria-hidden="true"></td>
<td>
<span>54</span><span>mL/hr</span>
</td>
<td>
<span>13.5</span><span>mL</span>
</td>
</tr>
<tr>
<td></td>
<td>
<span>11:05:09</span> - <span>12/19/16</span><span>11:20:09</span>
</td>
<td aria-hidden="true"></td>
<td>
<span>48</span><span>mL/hr</span>
</td>
<td>
<span>12</span><span>mL</span>
</td>
</tr>
</tbody>
</table>
for a datatable:
a caption
th row header and column header cell
Scope or header id attribute to associate cells with the headers in tables
Example:
<table>
<caption>City proper and Metropole area of largest cities in the world</caption>
<tr>
<td> </td>
<th scope="col">Shanghai</th>
<th scope="col">Karachi</th>
<th scope="col">Beijing</th>
</tr>
<tr>
<th scope="row">City proper</th>
<td>24,256,800</td>
<td>23,500,000</td>
<td>21,516,000</td>
</tr>
<tr>
<th scope="row">Metropole area</th>
<td>34,750,000</td>
<td>25,100,000</td>
<td>24,900,000</td>
</tr>
</table>
I have the same issue, that JAWS 2019 is not allowing Cursor navigation in the table cells. Especially cursor up/down in the same column is one of the accessibilty test cases that fails here.
I assume this has something to do with the <thead> and <tbody> elements not expected by the commonly used JAWS table navigation. Only option available is to use TAB/Shift+TAB to step through each cell in a row until the next/previous row can be accessed.
I need a logic in pl/sql to reduce valid_to date field by one day than new from_date.
Example: my current from and to dates are :
From: Jan-18-2016
To: Dec-31-9999
When new from and to dates arrive:
New From: Feb-1-2016
New To: Dec-31-9999
I want my old to_date to become Jan_31-2016 (ie, (Feb-1-2016) -1)
Currently I'm facing multiple data issue since there would be two valid_to dates at same time.
Please help
I have created dummy table with following data:
<table>
<tr>
<th>PRODUCT</th>
<th>FROM_DATE</th>
<th>VALID_TO</th>
</tr>
<tr>
<td>ABC</td>
<td>18-Jan-2016</td>
<td>31-Dec-9999</td>
</tr>
<tr>
<td>ABC</td>
<td>01-Feb-2016</td>
<td>31-Dec-9999</td>
</tr>
<tr>
<td>DEF</td>
<td>01-Aug-2016</td>
<td>31-Dec-9999</td>
</tr>
<tr>
<td>DEF</td>
<td>01-Sep-2016</td>
<td>31-Dec-9999</td>
</tr>
<tr>
<td>GHI</td>
<td>01-Mar-2016</td>
<td>31-Dec-9999</td>
</tr>
</table>
The following block will update the date according to your requirement. Using LAG and LEAD function you can access more than one row without joining the same table. LAG is used to access the previous row and LEAD is used to access the next row.
BEGIN
FOR I IN (SELECT NVL(LEAD(T.FROM_DATE)
OVER(PARTITION BY T.PRODUCT ORDER BY T.FROM_DATE) - 1,
T.VALID_TO) NEW_VALID_TO,
PRODUCT,
FROM_DATE
FROM PRODUCT_TABLE T) LOOP
UPDATE PRODUCT_TABLE A
SET A.VALID_TO = I.NEW_VALID_TO
WHERE A.PRODUCT = I.PRODUCT
AND A.FROM_DATE = I.FROM_DATE;
COMMIT;
END LOOP;
END;
The output will be as shown below:
<table>
<tr>
<th>PRODUCT</th>
<th>FROM_DATE</th>
<th>VALID_TO</th>
</tr>
<tr>
<td>ABC</td>
<td>18-Jan-2016</td>
<td>31-Jan-2016</td>
</tr>
<tr>
<td>ABC</td>
<td>01-Feb-2016</td>
<td>31-Dec-9999</td>
</tr>
<tr>
<td>DEF</td>
<td>01-Aug-2016</td>
<td>31-Aug-2016</td>
</tr>
<tr>
<td>DEF</td>
<td>01-Sep-2016</td>
<td>31-Dec-9999</td>
</tr>
<tr>
<td>GHI</td>
<td>01-Mar-2016</td>
<td>31-Dec-9999</td>
</tr>
</table>
I want to SUM from a query search result. I have a table called Students. I created a Search form to list students with scores from Jan or Feb, by date range. The results are different (two rows, four rows, so on) based on how many months I search. I created a Sum row at the bottom to count the total from that column for Jan or Feb. However, it doesn't work at all.
Can anyone help?
Here is my code:
<table>
<tr>
<td>Student Name</td>
<td>Jan</td>
<td>Feb</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><%=oRs("Name")%></td>
<td <%=sRowStyle%>><%=oRs("Jan")%></td>
<td <%=sRowStyle%>><%=oRs("Feb")%></td>
</tr>
<tr>
<td colspan="3"><% total = total + CInt(oRs("Jan")) oRs.MoveNext WEND %>
</td>
<tr>
</tr>
</table>
It looks like you haven't defined where your recordset loop starts
Try this:
<% Dim CountJan, CountFeb
Do while not oRS.eof %>
<tr>
<td><%=oRs("Name")%></td>
<td <%=sRowStyle%>><%=oRs("Jan")%></td>
<td <%=sRowStyle%>><%=oRs("Feb")%></td>
</tr>
<% CountJan = CountJan + Cint(oRs("Jan"))
CountFeb = CountFeb + Cint(oRs("Feb"))
oRs.MoveNext
Loop
%>
<tr>
<td> </td>
<td><%=CountJan%></td>
<td><%=CountFeb%></td>
</tr>
You can use while and wend instead of do while not and loop, its a matter of personal preference
Can I make the table with rules in my aspx page.
right now I am dispalying the page some thing like this.
Benefit Type : 000
Benfit Set: BCPCP
Converage Level : IND -Individual
Deductable Type : D-DED
Can I differnciate with the rules each and every row. like this
Benefit Type : 000
Benfit Set: BCPCP
Converage Level : IND -Individual
Deductable Type : D-DED
here is my Aspx code.. is there any way I can make like this?
<table>
<tr>
<td>
</td>
</tr>
You can just do a row with an hr in it like this: http://jsfiddle.net/WXSpD/
<table>
<tr>
<td>Benefit Type:</td>
<td>000</td>
</tr>
<tr>
<td colspan="2"><hr/></td>
</tr>
<tr>
<td>Benfit Set:</td>
<td>BCPCP</td>
</tr>
</table>
Your question is very hard to understand, but if you're just looking for a two-by-two table, can't you do it like this?:
<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
If there's something else you're looking for, can you clarify a little bit?
I have a view in ASP.NET MVC. It takes the model object and iterates over a list of strings and displays them in a table row, like so:
Details
<table>
<tbody>
<tr>
<th>Values in the database</th>
</tr>
<% foreach (string value in Model.lstDistinctValues)
{%>
<tr>
<%=value%>
<%} %>
</tr>
</tbody>
The problem is that the values appear ABOVE the header. So 'Values in the database' appears at the bottom, while the values are at the top.
Why would this be happening?
You need to add TD elements.
<table>
<tbody>
<tr>
<th>Values in the database</th>
</tr>
<% foreach (string value in Model.lstDistinctValues)
{%>
<tr>
<td><%=value%></td>
</tr>
<%} %>
</tbody>
</table>