Put your right paren in, take your right paren out...
-
I was asked to check why they're query wasn't working, so I was going to add a column to their table. I started to copy/paste a line... and the parens are just one of the million issues with this "classic" asp code... lovely
'Write out the orders found.
Response.Write "<table width=1000 cellspacing=0 cellpadding=0 class=style1><tr>" _
& "<td width=40>" & (rsSearch("WKCTR") & "</td>" _
& "<td width=65>" & (rsSearch("START") & "</td>" _
& "<td width=65>" & (rsSearch("FINISH") & "</td>" _
& "<td width=60>" & (rsSearch("JOBNO") & "</td>" _
& "<td width=55>" & (rsSearch("ORDNO") & "</td>" _
& "<td width=35>" & (rsSearch("OPSEQ") & "</td>" _
& "<td width=55>" & (rsSearch("FITEM") & "</td>" _
& "<td width=215>" & (rsSearch("FDESC") & "</td>" _& "<td width=45 class=style4>" & (rsSearch("REMAINING") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("TQCTD") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("SCRAP") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("ORTTL") & "</td>" _
& "<td width=45 class=style3>" & (Round(rsSearch("LABTIME")) & "</td>" _
& "<td width=45 class=style3>" & (Round(rsSearch("MACHTIME")) & "</td>" _
& "<td width=15 class=style3>" & (rsSearch("CONDS") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("CONQT") & "</td>" _
& "<td width=80>" & (rsSearch("OSTAT") & "</td>" _
& "</tr><br></table>"))))))))))))))))) -
I was asked to check why they're query wasn't working, so I was going to add a column to their table. I started to copy/paste a line... and the parens are just one of the million issues with this "classic" asp code... lovely
'Write out the orders found.
Response.Write "<table width=1000 cellspacing=0 cellpadding=0 class=style1><tr>" _
& "<td width=40>" & (rsSearch("WKCTR") & "</td>" _
& "<td width=65>" & (rsSearch("START") & "</td>" _
& "<td width=65>" & (rsSearch("FINISH") & "</td>" _
& "<td width=60>" & (rsSearch("JOBNO") & "</td>" _
& "<td width=55>" & (rsSearch("ORDNO") & "</td>" _
& "<td width=35>" & (rsSearch("OPSEQ") & "</td>" _
& "<td width=55>" & (rsSearch("FITEM") & "</td>" _
& "<td width=215>" & (rsSearch("FDESC") & "</td>" _& "<td width=45 class=style4>" & (rsSearch("REMAINING") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("TQCTD") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("SCRAP") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("ORTTL") & "</td>" _
& "<td width=45 class=style3>" & (Round(rsSearch("LABTIME")) & "</td>" _
& "<td width=45 class=style3>" & (Round(rsSearch("MACHTIME")) & "</td>" _
& "<td width=15 class=style3>" & (rsSearch("CONDS") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("CONQT") & "</td>" _
& "<td width=80>" & (rsSearch("OSTAT") & "</td>" _
& "</tr><br></table>")))))))))))))))))I should note that it's printing each data-row in it's own table.
-
I should note that it's printing each data-row in it's own table.
ColinBashBash wrote:
I should note that it's printing each data-row in it's own table.
Not always a bad thing. If some items are overly long, they'll cause some rows of the table not to match others, but the entire table won't get pushed out by an overly-long item. Further, depending upon how many items there are, some browsers may display a number of short tables better than one really long one. I wouldn't consider the HTML table split horrible, even though the formatting of the source code is nasty.
-
ColinBashBash wrote:
I should note that it's printing each data-row in it's own table.
Not always a bad thing. If some items are overly long, they'll cause some rows of the table not to match others, but the entire table won't get pushed out by an overly-long item. Further, depending upon how many items there are, some browsers may display a number of short tables better than one really long one. I wouldn't consider the HTML table split horrible, even though the formatting of the source code is nasty.
Guys, If you look careful, you will discover that the problem is not actually the HTML table, but the wrong usage of parenteses which make the code very dificult to understand. In each line, the guy put a open parenteses to separate the function call, and not close it in time. So, at the end of code block, you have a lot of parenteses. In time, the parenteses aren't need it this case and don't change the return of expression.
-
Guys, If you look careful, you will discover that the problem is not actually the HTML table, but the wrong usage of parenteses which make the code very dificult to understand. In each line, the guy put a open parenteses to separate the function call, and not close it in time. So, at the end of code block, you have a lot of parenteses. In time, the parenteses aren't need it this case and don't change the return of expression.
Personally I'm glad the parentheses are there because now I can clearly see the precedence of the & operators. Without the parentheses I would be totally lost and wouldn't be able to follow the code. I think this is an excellent example of self-documenting code.
-
I was asked to check why they're query wasn't working, so I was going to add a column to their table. I started to copy/paste a line... and the parens are just one of the million issues with this "classic" asp code... lovely
'Write out the orders found.
Response.Write "<table width=1000 cellspacing=0 cellpadding=0 class=style1><tr>" _
& "<td width=40>" & (rsSearch("WKCTR") & "</td>" _
& "<td width=65>" & (rsSearch("START") & "</td>" _
& "<td width=65>" & (rsSearch("FINISH") & "</td>" _
& "<td width=60>" & (rsSearch("JOBNO") & "</td>" _
& "<td width=55>" & (rsSearch("ORDNO") & "</td>" _
& "<td width=35>" & (rsSearch("OPSEQ") & "</td>" _
& "<td width=55>" & (rsSearch("FITEM") & "</td>" _
& "<td width=215>" & (rsSearch("FDESC") & "</td>" _& "<td width=45 class=style4>" & (rsSearch("REMAINING") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("TQCTD") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("SCRAP") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("ORTTL") & "</td>" _
& "<td width=45 class=style3>" & (Round(rsSearch("LABTIME")) & "</td>" _
& "<td width=45 class=style3>" & (Round(rsSearch("MACHTIME")) & "</td>" _
& "<td width=15 class=style3>" & (rsSearch("CONDS") & "</td>" _
& "<td width=45 class=style3>" & (rsSearch("CONQT") & "</td>" _
& "<td width=80>" & (rsSearch("OSTAT") & "</td>" _
& "</tr><br></table>")))))))))))))))))The other users got this right of course...bad and incorrect use of parens but jeez dont you just hate this style of ASP coding! I havent done ASP is years now but isnt this so much easier to look at that than trash:
<table width="1000" cellspacing="0" cellpadding="0" class="style1">
<tr>
<td width="40"><% = rsSearch("WKCTR") %></td>
<td width="40"><% = rsSearch("START") %></td>
<td width="40"><% = rsSearch("FINISH") %></td>
<td width="40"><% = rsSearch("JOBNO") %></td>
</tr>
</table>