473,320 Members | 1,804 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,320 software developers and data experts.

Can I calculate between different datasets?

I am working on a report where I use the same query with different data sources. both databases are build the same way and I can show the data from both datasets. At the moment it looks like this:

Expand|Select|Wrap|Line Numbers
  1. DATASET1 TABLE         DATASET2 TABLE
  2. 4234                        23423
  3. 52226                     2342342
  4. 55522                       14234
  5. 6788                       234234
  6. 22568                       23532
  7.  
Of course each table belongs to different dataset. I was wondering if it is possible to calculate the difference between the upper colums, so it would look like this

Expand|Select|Wrap|Line Numbers
  1. DATASET1 TABLE        DATASET2 TABLE     DIFFERENCE
  2. 4234                       23423             -19189
  3. 52226                    2342342           -2290116
  4. 55522                      14234              41288 
  5. 6788                      234234            -227446
  6. 22568                      23532               -964
  7.  
and the also color the cell red or green :) I am using the 2005 version
Nov 18 '09 #1
5 3142
ck9663
2,878 Expert 2GB
The color of the cell, I doubt if that's possible.

For the merging of the two result sets, use JOIN.

Happy Coding!!!


--- CK
Nov 18 '09 #2
Hm, but how, the results are from two different datasources. And I cant find the option for one dataset using multiple datasources. So, I have two datasets.

I just started working with this tool, so I am still learning.

As for the color, I found a way :)
Nov 19 '09 #3
ck9663
2,878 Expert 2GB
Could you post the structure of your datasets?

--- CK
Nov 19 '09 #4
nbiswas
149 100+
If I have understood ur question properly then here is the answer

Declare @table1 table(dataset1 int)
Declare @table2 table(dataset2 int)
insert into @table1
select 4234 union all select 52226 union all
select 55522 union all select 6788 union all
select 22568
insert into @table2
select 23423 union all select 2342342 union all
select 14234 union all select 234234 union all
select 23532

Expand|Select|Wrap|Line Numbers
  1. select X.dataset1,Y.dataset2,X.dataset1 - Y.dataset2 [Difference]  from
  2.  
  3. (select 
  4.     ROW_NUMBER() over(order by getdate()) rn1
  5.     ,dataset1 from @table1)X    
  6.     inner join 
  7. (select 
  8.     ROW_NUMBER() over(order by getdate()) rn2
  9.     ,dataset2 from @table2)Y    
  10.     on X.rn1 = Y.rn2
The output is

dataset1 dataset2 Difference
Expand|Select|Wrap|Line Numbers
  1. 4234    23423    -19189
  2. 52226    2342342    -2290116
  3. 55522    14234    41288
  4. 6788    234234    -227446
  5. 22568    23532    -964
Nov 21 '09 #5
Well, I can show you these 2 pictures





Report shows how the report should look like, I have three tables, Burin, Grom, Baracuda, each has its own dataset, which are named on the left side. The column Test should have an expression where it would calculate the difference between columns Grom and Burin (example)

Report2 show the query, as you can see its the same query for each document in a single datasource. But I have 3 different datasources, the result of which are 3 datasets on the left.

I have the same query on al three datasets. I get the same colums, just different COUNT(DocLinkDocID) value, and I need to show that difference. I hope I am making sense now :D

Sorry for the late reply, had a long weekend over here :)
Nov 24 '09 #6

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

Similar topics

1
by: Building Blocks | last post by:
Hi, All I need is a simle calculate form script which contains this: A script that can handle text input, radio buttons, checkboxes, and dropdowns. Each one of these variables will contain a...
16
by: Luqman | last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ? Best Regards, Luqman
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
2
by: S.Tedeschi | last post by:
Hi all gurus. I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app heavily relying on StronglyTyped DataSets, with lots of FindByKey..., dataSet.Tablename, and similar methods....
0
by: S.Tedeschi | last post by:
Hi all; as posted some days ago, I'm converting an on-line app; I used to heavily rely on strongly-typed DataSets directly dropped onto pages, and so viewed by code(-behind) as well. In the next...
7
by: jamesnkk | last post by:
Hi, Although this question may not directly link to Access, but I think it a common question to those developer.so hope you could suggest a solution. How do I get the average cost for Item sold,...
1
by: Bakarre | last post by:
To display a field from databse and calculate time different -------------------------------------------------------------------------------- Good day, i have problem to display a field from...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
5
FishVal
by: FishVal | last post by:
IMHO, the following is not a how-to-do instruction to solve a particular problem but more a concept-proof stuff demonstrating possibilities of SQL. So, let us say the problem is to calculate...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.