Register Blogs FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "Help with asp display / recordset (troubleshoot)" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). Visit the ASP Development forum for help with ASP/VBScript and ASP/JScript applications.


Reply
 
LinkBack Thread Tools Display Modes
  #11  
Old June 27th, 2008, 09:51 AM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 256
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

ok... here it is:

Code:
SELECT     dbo.tblTools.Tools, dbo.tblTools.OnOrder1, dbo.tblTools.OnOrder2, dbo.tblTools.OnOrder3, dbo.tblTools.OnOrder4, 
                      dbo.tblHistory.CurrentMoYr, SUM(dbo.tblHistory.RolloutShipped) AS SumShipped, dbo.tblHistory.RolloutShipped, 
                      dbo.tblHistory.DistrictID, dbo.tblHistory.RegionID, dbo.tblTools.MeetingID, dbo.tblRegion.RegionName, 
                      dbo.tblDistricts.District_Location, dbo.tblHistory.MoID, dbo.tblHistory.ToolID
FROM         dbo.tblHistory INNER JOIN
                      dbo.tblRegion ON dbo.tblHistory.RegionID = dbo.tblRegion.RegionID INNER JOIN
                      dbo.tblDistricts ON dbo.tblHistory.DistrictID = dbo.tblDistricts.DistrictID LEFT OUTER JOIN
                      dbo.tblTools ON dbo.tblHistory.ToolID = dbo.tblTools.ToolID
GROUP BY dbo.tblTools.Tools, dbo.tblTools.OnOrder1, dbo.tblTools.OnOrder2, dbo.tblTools.OnOrder3, dbo.tblTools.OnOrder4, 
                      dbo.tblHistory.CurrentMoYr, dbo.tblHistory.RolloutShipped, dbo.tblHistory.DistrictID, 
                      dbo.tblHistory.RegionID, dbo.tblTools.MeetingID, dbo.tblRegion.RegionName, dbo.tblDistricts.District_Location, 
                      dbo.tblHistory.MoID, dbo.tblHistory.ToolID
HAVING      (dbo.tblTools.MeetingID = 1) OR
                      (dbo.tblTools.MeetingID = 2)
Reply With Quote
Sponsored Links
  #12  
Old June 27th, 2008, 11:01 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 863
Thanks: 20
Thanked 78 Times in 75 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default

If Query Analyzer returns the correct data, then you're right, it's probably an issue with the ASP logic. Have you checked your page source after the page is rendered? That might give a hint as to where the logic is wrong.
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding
Reply With Quote
  #13  
Old June 27th, 2008, 11:06 AM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 256
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

Quote:
Originally Posted by jmurrayhead View Post
If Query Analyzer returns the correct data, then you're right, it's probably an issue with the ASP logic. Have you checked your page source after the page is rendered? That might give a hint as to where the logic is wrong.
o, i totally forgot about checking that out....will check now. Thanks Jim!

i don't understand why it shows the correct toolID just not the right shipped qty value......if my first record strQ1Shipped value is NULL, should the below be an issue? remember i'm handling the null in the asp side sql statement to make 0. See anything weird?

Code:
If strQ1Shipped <> 0 then
				Response.Write("<td align=center colwidth=""50""><A href="//server/test/ShipResults.asp?ToolID=" & strToolID &"""><b>" & strQ1Shipped & "</b></a></td>")
				strQ1Shipped = 0
			Else
				Response.Write("<td align=center colwidth=""50""><b>" & strQ1Shipped & "</b></td>")
				strQ1Shipped = 0
			End If

Last edited by Rebelle; June 27th, 2008 at 11:41 AM.
Reply With Quote
  #14  
Old June 27th, 2008, 11:55 AM
mehere's Avatar
Super Sarcasm Mistress
 
Join Date: Mar 2008
Location: Wide Awake In Dreamland
Posts: 147
Thanks: 11
Thanked 27 Times in 25 Posts
Rep Power: 1
mehere will become famous soon enough

Awards Showcase
Microsoft SQL Server Classic ASP 
Total Awards: 2

Default

can you show me what the query returns in the query analyzer? after i see that, i'll take a look at your ASP code and see where the issue might be.
__________________
Quote of the Month:
Quality: The race for quality has no finish line- so technically, it's more like a death march.

Questions to Ponder:
What do you do when you see an endangered animal eating an endangered plant?

iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
copyright © 2008 sbenj69
Reply With Quote
  #15  
Old June 27th, 2008, 12:26 PM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 256
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

okie here is it mehere....

this is taking the sql statement i have on the asp page from the sql vw.

sorry it's the most i could fit on the screen, the 3rd tool listed has more records that add up to (5)...but what you see on attachment is all i could fit in....

but my asp looks like below, it's starting off with (0) on Q1Shipped and pushed the results down by 1, making that (5) show up on tool 4.

Code:
Tools | Q1-08 |Q1 Shipped |Q2-08| Q3-08 |Q4-08 
tool1 | 0        |0               |0      |0         | 0 
tool2 | 5        | 0              |5      |4         | 4 
tool3 |10        | 0             |4       |4         | 4 
tool4 | 6         |5      |4       |4        | 4
Thanks!
Attached Images
File Type: jpg results.jpg (64.6 KB, 3 views)
Reply With Quote
  #16  
Old June 27th, 2008, 12:38 PM
mehere's Avatar
Super Sarcasm Mistress
 
Join Date: Mar 2008
Location: Wide Awake In Dreamland
Posts: 147
Thanks: 11
Thanked 27 Times in 25 Posts
Rep Power: 1
mehere will become famous soon enough

Awards Showcase
Microsoft SQL Server Classic ASP 
Total Awards: 2

Default

which post has your code for the display? sorry ... i'm just working between 2 desks and i don't have time to really look for it. or if you can post it again, that would be good.
Reply With Quote
  #17  
Old June 27th, 2008, 12:42 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 863
Thanks: 20
Thanked 78 Times in 75 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default

Quote:
Originally Posted by mehere View Post
which post has your code for the display? sorry ... i'm just working between 2 desks and i don't have time to really look for it. or if you can post it again, that would be good.
http://www.developerbarn.com/2128-post3.html
Reply With Quote
  #18  
Old June 27th, 2008, 01:03 PM
mehere's Avatar
Super Sarcasm Mistress
 
Join Date: Mar 2008
Location: Wide Awake In Dreamland
Posts: 147
Thanks: 11
Thanked 27 Times in 25 Posts
Rep Power: 1
mehere will become famous soon enough

Awards Showcase
Microsoft SQL Server Classic ASP 
Total Awards: 2

Default

okie dokie ... change this line:
Code:
If strTools<>strLastTools Then
to
Code:
If strTools<>strLastTools and strLastTools <> "" Then
what's happening is strLastTools is blank when you start, so it's writing your first record, at that point strQ1Shipped is 0 ... then when it gets to your second record, it's using the total of strQ1Shipped from your previous record which is why 5 is showing for tool4 and not tool3.

however, because you need to read the records and to get your total before posting, you will also need to get prev values for all your other records as well.

so, in essence you need something like this:
Code:
do while not rs.EOF
	if i > iStopRec then
		exit do
	end if

	strTools = rs("Tools")
	strQ1 = rs("OnOrder1")
	if strTools <> strLastTools then
		strQ1Shipped = rs("SumShipped")
	else
		strQ1Shipped = strQ1Shipped + rs("SumShipped")
	end if
	strQ2 = rs("OnOrder2")
	strQ3 = rs("OnOrder3")
	strQ4 = rs("OnOrder4")
	
	strToolID = rs("ToolID")

	
	If strTools<>strLastTools and strLastTools <> "" or rs.EOF Then'I'm not sure if the rs.EOF will work.  Just a thought.
	
		Response.Write("<tr><td colwidth=""150""><b>" & strLastTools & "</b></a></td>")
		Response.Write("<td align=center colwidth=""50""><b>" & strPrevQ1 & "</b></td>")
			If strPrevQ1Shipped <> 0 then
				Response.Write("<td align=center colwidth=""50""><A href="http://www.developerbarn.com/asp-development/"//server/test/ShipResults.asp?ToolID=" & strPrevID &"""><b>" & strPrevQ1Shipped & "</b></a></td>")
			Else
				Response.Write("<td align=center colwidth=""50""><b>" & strPrevQ1Shipped & "</b></td>")
			End If
	
		Response.Write("<td align=center colwidth=""50""><b>" & strPrevQ2 & "</b></td>")
		Response.Write("<td align=center colwidth=""50""><b>" & strPrevQ3 & "</b></td>")
		Response.Write("<td align=center colwidth=""50""><b>" & strPrevQ4 & "</b></td></tr>")
		


	End If
	strLastTools = strTools
	strPrevQ1Shipped = strQ1Shipped
	strPrevQ2 = strQ2
	strPrevQ3 = strQ3
	strPrevQ4 = strQ4
	strPrevID = strToolID

%>


<%
	i = i + 1
  rs.MoveNext
loop
%>
what this is doing, is when the strTool changes it will post the previous record. problem with this is, you may lose the last record. i'm thinking you may have to do this in a stored proc that will create a table to get your data correctly so that when you display it, there is no issue.

give the above code a shot. if the rs.EOF fails in the IF/Then statement, we're going to have to look at a stored proc to do this.

Comments on this post
jmurrayhead agrees: Nicely done, mehere

Last edited by mehere; June 27th, 2008 at 01:06 PM.
Reply With Quote
The Following User Says Thank You to mehere For This Useful Post:
Rebelle (June 27th, 2008)
  #19  
Old June 27th, 2008, 01:16 PM
mehere's Avatar
Super Sarcasm Mistress
 
Join Date: Mar 2008
Location: Wide Awake In Dreamland
Posts: 147
Thanks: 11
Thanked 27 Times in 25 Posts
Rep Power: 1
mehere will become famous soon enough

Awards Showcase
Microsoft SQL Server Classic ASP 
Total Awards: 2

Default

if this doesn't work ... and i'm not too confident it will, if you could provide me with your table layout and sample data, i could work on a query or stored proc that will get you the data you need.
Reply With Quote
  #20  
Old June 27th, 2008, 02:01 PM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 256
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

Thanks Mehere,

Gave it a try and it's close but not yet lined up....
when I tried all the changes, it now does line up the q1Shipped column with the other qtr columns, but it got rid of tool1 so it now unaligned toolname with the other columns....
Code:
ex:  
tool2----------q1 for tool1 value------q1Ship for tool1 value----other cols.
tool3----------q1 for tool2 value------q1Ship for tool2 value----other cols.
tool4----------q1 for tool3 value------q1Ship for tool3 value----other cols.
will send table layout and sample data to ya.

Disregard the above, I had strTools displaying instead of strLastTools on the response.write line....it lines things up starting with tool1 but it's just not showing the last line (last tool with other columns). w00t!

Last edited by Rebelle; June 27th, 2008 at 02:09 PM. Reason: read text in blue!
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -4. The time now is 08:35 PM.



Content Relevant URLs by vBSEO 3.2.0