473,395 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Duplicate Data in a Report = erroneous data

269 256MB
I have a query HOTSTICK_ORDER_DETAILS which calculates how many hotsticks a customer must pay for. The name of the field is QTY_CHARGED. (It is calculated by knowing how many sticks they order, how many they return when the sticks expire, and how many they abuse.) My goal is to print out a sheet grouping sticks by commodity numbers that shows how many sticks we can charge to a customer due to customers not returning or abusing sticks. The problem is if a customer owes for 3 sticks which are 2 different kinds of commodity numbers, the report is trying to show he owes 3 sticks in every commodity the customer originally ordered from. To see for yourself, open the attached DB. Look in HOTSTICK_ORDER_DETAILS Query. Notice ORDER_NUM 20070001 includes
1 QTY_CHARGED for COMMODITY_DESC 3775608
1 QTY_CHARGED for COMMODITY_DESC 3775756
0 QTY_CHARGED for COMMODITY_DESC 3775822
0 QTY_CHARGED for COMMODITY_DESC 3775806.
A report built off this query, rptReplenishInventory, shows
2 entries in Commodity 3775608
2 entries in Commodity 3775756
2 entries in Commodity 3775806
2 entries in Commodity 3775822.

What I *want* it to show is 1 entry, showing the correct quantity, in 3775608 and 3775756, and no entries anywhere else.

What I have tried so far:
Went to report properties...record source....which opened the Query Builder. I clicked properties there and tried to play around with "Unique Records" and "Unique Values." However, I could not achieve desired results.

Can anyone help? Thanks in advance.
Oct 28 '09 #1
7 2339
ChipR
1,287 Expert 1GB
It sounds like you want a filter on your report "WHERE QTY_CHARGED > 0". What's the source of the box that is displaying "2" in each entry?
Oct 28 '09 #2
DanicaDear
269 256MB
The source is the QTY_CHARGED field from the query. (It's a calculated field.) I have already set the criteria of QTY_CHARGED to >0. Thanks.
Oct 28 '09 #3
NeoPa
32,556 Expert Mod 16PB
Danica,

While it is sometimes necessary to attach a database to a thread, it is not required in all cases. It makes it harder to work through a problem and it fills up the site storage with too many large files. It does your cause no favours either. Members don't want to go to that much effort over each question as it means they can get far less work done. I very rarely even download a database unless it's been requested.

This seems like a simple query question, so we need the query posted in SQL, and maybe, if it's complicated, the MetaData of the relevant tables.

As a general guide, don't post a database unless asked to by someone trying to help.

This is likely to be a JOIN problem, or maybe a GROUPing problem, but we'd need to see the query to be more precise.
Oct 29 '09 #4
DanicaDear
269 256MB
Here is what I *think* you are asking for. (If not, please help me try again.)
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [HOTSTICK_ORDER_DETAILS Query].ORDER_NUM,
  2.                 HOTSTICK_ORDER_DETAILS.COMMODITY_DESC,
  3.                 [HOTSTICK_ORDER_DETAILS Query].QTY_CHARGED,
  4.                 [HOTSTICK_ORDER_DETAILS Query].CHARGED_OUT,
  5.                 [HOTSTICK_ORDER_DETAILS Query].QTY_ABUSED,
  6.                 [HOTSTICK_ORDER_DETAILS Query].MISSING_STICKS,
  7.                 [HOTSTICK_ORDERS Query].CUST_NUM,
  8.                 HOTSTICK_ACCOUNT.PRCN,
  9.                 HOTSTICK_ACCOUNT.RT,
  10.                 HOTSTICK_ACCOUNT.ACTIVITY,
  11.                 HOTSTICK_ACCOUNT.EWO,
  12.                 HOTSTICK_ACCOUNT.PROJECT,
  13.                 HOTSTICK_ACCOUNT.LOCATION,
  14.                 HOTSTICK_ACCOUNT.FERC,
  15.                 HOTSTICK_ACCOUNT.SUB,
  16.                 HOTSTICK_ACCOUNT.RORG,
  17.                 [HOTSTICK_CUSTOMERS Query].Whole_Name
  18.  
  19. FROM            ((HOTSTICK_CUSTOMERS INNER JOIN
  20.                 (([HOTSTICK_ORDERS Query] INNER JOIN
  21.                 [HOTSTICK_ORDER_DETAILS Query]
  22.   ON            [HOTSTICK_ORDERS Query].[ORDER_NUM]=[HOTSTICK_ORDER_DETAILS Query].[ORDER_NUM]) INNER JOIN
  23.                 HOTSTICK_ORDER_DETAILS
  24.   ON            [HOTSTICK_ORDERS Query].[ORDER_NUM]=HOTSTICK_ORDER_DETAILS.[ORDER_NUM])
  25.   ON            HOTSTICK_CUSTOMERS.[CUST_NUM]=[HOTSTICK_ORDERS Query].[CUST_NUM]) LEFT JOIN
  26.                 HOTSTICK_ACCOUNT
  27.   ON            HOTSTICK_CUSTOMERS.[CUST_NUM]=HOTSTICK_ACCOUNT.[CUST_NUM]) INNER JOIN
  28.                 [HOTSTICK_CUSTOMERS Query]
  29.   ON            HOTSTICK_CUSTOMERS.CUST_NUM=[HOTSTICK_CUSTOMERS Query].CUST_NUM
  30.  
  31. WHERE           ((([HOTSTICK_ORDER_DETAILS Query].QTY_CHARGED)>0)
  32.   AND           (([HOTSTICK_ORDER_DETAILS Query].CHARGED_OUT)=False));
I have never even heard the word "MetaData" before. :-)

What you say about the attachments makes sense. I thought it would speed you up but I forget you all are whizes and can understand a problem and solution without ever seeing a file. (I do not understand how you do it!!) Is it possible to remove the attachment? Thanks so much for everything.
Oct 29 '09 #5
DanicaDear
269 256MB
I believe I have solved this issue. In my Query Builder for the report, I had the query and the original table shown. It was messy and I think it was pulling data twice...once from the table and once from the query. I cleaned it up a bit and poof: it worked!

PS. Should I give myself the "Best Answer" award? LOL. (I would NEVER...too undeserving!)

Thanks everyone! I am very appreciative!
Oct 29 '09 #6
NeoPa
32,556 Expert Mod 16PB
@DanicaDear
That's right on the button Danica. I've changed the layout of it so that it can be read more easily (worth noting for future reference) but this is exactly the data I was hoping to work from.

Having looked through it somewhat I can see that it is quite complex in itself. The fact that some of the input sources are also queries, so could have data coming from multiple sources themselves, just adds to the complexity. I have to say that it's lucky that you found a solution, as this would be difficult to know too much about, especially without the MetaData. To liiustrate MetaDat, and hopefully give you an idea of what I'm talking about, I'll copy in a template post I use when requesting it.
This will work much better if you can post the meta-data (info about the layout / structure) of the table in the same way as I use in my example. Click on the Reply button and you will have access to all the codes I've used. PK & FK stand for Primary Key & Foreign Key respectively. Never use TABs in this as the layout gets mucked up. Use spaces and all is fine.
Table Name=[tblStudent]
Expand|Select|Wrap|Line Numbers
  1. Field           Type      IndexInfo
  2. StudentID       AutoNumber    PK
  3. Family          String        FK
  4. Name            String
  5. University      String        FK
  6. Mark            Numeric
  7. LastAttendance  Date/Time
Oct 30 '09 #7
NeoPa
32,556 Expert Mod 16PB
@DanicaDear
We are trying to make the Best Answer more about which answer would actually be the most help for someone scanning through the list via Google, rather than awarding special points to members.

That is why I am setting some of them myself, and other moderators have been encouraged to do the same, where a thread has none. The criteria to use is to consider which post, if alone, would be the most help to an interested searcher.

In this scenario, I almost awarded it to your post (It wouldn't be the first I'd awarded to the OP of a thread). In the end though there was too little info there for anyone to benefit, though it was very useful to let us know we needn't bust any guts to find one for you.

Keep going and I'm sure you'll get one eventually. You certainly seem to be picking lots up on your way :)
Oct 30 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
0
by: Schlauberger | last post by:
I am currently developing a VB.Net App that utilized an MS Access file to store the data. My Report data source is a Parameter Query in MS Access when the report loads the parameter is prompted...
6
by: nick4soup | last post by:
I have read the CGI FAQ 'How can I avoid users hitting "submit" twice' (on http://www.htmlhelp.org/faq/cgifaq.3.html#19 ) which essentially says you have to detect it at the server, using a...
2
by: Brad Allison | last post by:
I have created a short routine to read certain data from an AS400 and put it into a small table stored in Access (I know not the best data store, but it is what we have for now). Anyway, some of...
6
waynetheengineer
by: waynetheengineer | last post by:
Hi all, I have a database that has two tables: 1 table shows different types of animals: e.g. rabbits, bears, birds, etc. a 2nd table that links to each animal type that has individual animals...
1
by: JRWarring | last post by:
I have a VB application with about 75 installations that uses the Crystal Control (Version 7.0) to print Crystal RPTs. On about 7 of these installations the clients are getting duplicate lines...
5
by: orabalu | last post by:
Hi Guys, Can you give me some examples for Incremental load in PL/SQL for Datawarehouse projects. Regards, Balu
1
by: tosachinji | last post by:
Hi I am new to xslt. Could you please tell me, how can we remove duplicate records from a xml file. Here is the xml file: <Row> <Cell><Data>Active</Data></Cell> <Cell><Data>D</Data></Cell>...
2
by: Don Barton | last post by:
I have 2 tables, Table 1 has Name, NameID, and A, B, C fields. Table 2 has Name, NameID, and D, E fields. Several of the Names/NameID are the same in both databases. I want my merged the tables...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.