.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 26th, 2009, 10:13 AM
bazzanoid bazzanoid is offline
Contributing User
Click here for more information.
 
Join Date: Nov 2004
Posts: 153 bazzanoid User rank is Corporal (100 - 500 Reputation Level)bazzanoid User rank is Corporal (100 - 500 Reputation Level)bazzanoid User rank is Corporal (100 - 500 Reputation Level)bazzanoid User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 17 h 33 m 57 sec
Reputation Power: 7
Populating RS but ignoring certain records?

Hiya,

Is there a way to ignore certain records when populating a recordset?

In this instance, a total is built up by moving through each record, but it will double up on some parts, which i need to get it to ignore.

Each record has the fields FacetPartNo (the field i'm interested in) and LinkStock1, which tells us it's the same part as another FacetPartNo, and therefore needs to be ignored.

Example:

FacetPartNo = 12345, LinkStock1=null, Value=£100
FacetPartNo = 23456, LinkStock1=34567, value=£50
FacetPartNo = 34567, LinkStock1=null, value=£50

This shows that 23456 is the same as 34567 so when doing calculations i need it to ignore 34567.

Can this be done?

Current coding for the counting:

Code:
objRS = objConn.Execute("SELECT FacetPartNo,Supplier1Price,RetailPrice,TradePrice,  WholesalePrice,DistributorPrice,StockLevel FROM prices")

StockCount = 0
StockValueR = 0
StockValueT = 0
StockValueW = 0
StockValueD = 0
StockValueN = 0

While Not objRS.EOF

StockCount = cdec(StockCount) + cdec(objRS.Fields("StockLevel").value)
StockValueR = cdec(StockValueR) + (cdec(objRS.Fields("RetailPrice").value) * objRS.Fields("StockLevel").Value)
StockValueT = cdec(StockValueT) + (cdec(objRS.Fields("TradePrice").value) * objRS.Fields("StockLevel").Value)
StockValueW = cdec(StockValueW) + (cdec(objRS.Fields("WholesalePrice").value) * objRS.Fields("StockLevel").Value)
StockValueD = cdec(StockValueD) + (cdec(objRS.Fields("DistributorPrice").value) * objRS.Fields("StockLevel").Value)
StockValueN = cdec(StockValueN) + (cdec(objRS.Fields("Supplier1Price").Value) * objRS.Fields("StockLevel").Value)

objRS.movenext

End While


Thanks!

Baz

Last edited by bazzanoid : October 26th, 2009 at 10:17 AM.

Reply With Quote
  #2  
Old October 27th, 2009, 03:38 AM
micky's Avatar
micky micky is offline
Couch Potato Wizard
Click here for more information. Click here for more information
 
Join Date: Jan 2005
Location: India
Posts: 12,259 micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)micky User rank is General 18th Grade (Above 100000 Reputation Level)  Folding Points: 1480 Folding Title: Novice Folder
Time spent in forums: 5 Months 4 Days 2 m 48 sec
Reputation Power: 2179
Sorry, i really dont understand what you need here

Do you want to ignore record if FacetPartNo = 34567 or LinkStock1=34567 or both = 34567 or something else??
__________________
Laziness is my religion and Sunday is my God

Get the Mantra!

Reply With Quote
  #3  
Old October 27th, 2009, 04:24 AM
bazzanoid bazzanoid is offline
Contributing User
Click here for more information.
 
Join Date: Nov 2004
Posts: 153 bazzanoid User rank is Corporal (100 - 500 Reputation Level)bazzanoid User rank is Corporal (100 - 500 Reputation Level)bazzanoid User rank is Corporal (100 - 500 Reputation Level)bazzanoid User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 17 h 33 m 57 sec
Reputation Power: 7
I want to ignore any records in the table where FacetPartNo is equal to a previous LinkStock1 - the purpose of LinkStock1 is to tell the system if a part number (FacetPartNo) is shared with another part, and therefore only count once. So if a particular part number is linked to two or three others, it will only count it once.

I was thinking if it's possible to build a list from the LinkStock1 field first then a select statement told to exclude any FacetPartNo records in the list, if you see what i mean!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Populating RS but ignoring certain records?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek