Store Data Flow Totals in variables

Posted on 2010-09-02
Last Modified: 2013-11-10
How can I store totals from my dataflow dataset into variables?

Currently, I collect my target dataset from SQL, manipulate it, apply conitional filtering, etc. Once the dataset is the way I want it in memory, I use Multicast to copy the dataset. On the copy, I use an Aggregate Tranform to get the count & a sum of a column. Now I need to load these 2 aggregate values in a variable.

If there is a better way to get these totals into variables other than splitting off the dataset using Multicast & an aggregate, let me know. One thing I can't do is handle all of this in the initial SQL script. The totals need to be based on the dataset in memory that was built in my Data Flow.
Question by:JeepGeekin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3

Author Comment

ID: 33588107
Also, I better mention that the dataset gets dumped in a text file at the end of this data flow. That's why I copied it to get my aggregrate totals.
LVL 16

Expert Comment

ID: 33588873
you can use record set destination but..its not advisable

if you can specify the exact filtering conditions and agrregation level with your sql...We can suggest you a way to handle everything using Sql code.

Author Comment

ID: 33588945
I think the main thing I am doing that I cannot do in a SQL script is to merge data with a flat file. Then we do some cleanup after that before aggregating it.
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.


Author Comment

ID: 33589046
What about using a Script component? I haven't used one yet, but I see a place for variable interaction.
LVL 16

Expert Comment

ID: 33589177
Since you are actually trying to store the values of your dataset into variables that they can be used in the next task in Control flow..Script Component wouldn't be of much help..

Where do you want to use these values stored in variable?

Author Comment

ID: 33589255
In a script task in the control flow. I need to make some decisions in this based on the totals.
LVL 16

Accepted Solution

vdr1620 earned 500 total points
ID: 33589459
why do you want o store the values in the variable..i would suggest you to derive those decisions using script component instead of storing the values in variables and using them later on in script task

I would like to know what you are exactly trying to do .. to help you better

Author Comment

ID: 33591419
I got that to work. Good suggestion. Thanks vdr1620.

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
export sql server dbs 2 26
SQL syntax for max(date) 3 37
Display Day name if condition is true in crystal report (VB.Net) 2 35
SQL Server 2012 and core licensing 5 30
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question