Wednesday, February 10, 2010


 


 


 

  1. A) Create String Variable "SourcePath" for the Source Folder and Assign Value C:\DatFiles\Pending

    B) Select Script Component from Transformation Control and choose the "Source Option" and

    Edit Script component and set Read Only Variable like here.



     


     

  2. Create OutPut Columns and set the datatype to hold the Out put rows


3 a) Read File Names from Folder using VB.Net or C#.NET

public
override
void CreateNewOutputRows()

    {


 


 


string folderPath = "";


// Asign Package Variable Path to local Variable

folderPath = Variables.SourcePath;


DirectoryInfo dir = new
DirectoryInfo(folderPath);


if(dir.Exists)

{


if (dir.GetFiles().Length > 0)

{


FileInfo[] dirFiles = dir.GetFiles();


foreach (FileInfo fiInfo in dirFiles)

{

SourceFilesBuffer.AddRow();

SourceFilesBuffer.FileName = fiInfo.Name;

SourceFilesBuffer.CreatedDate = fiInfo.CreationTime;

}

}

}


 

b) Write OutPut in to OLEDB Table like step 1. B)


 

  1. A) Create Source File and Pending Files Variables for Load Current Filename and Hold All Filenames Respectively

    b) Select Source Filenames from OLEDB Table and Assign Rows into PendingFiles Object Variable

    Using Execute SQL Task Editor

    Please refer the URL….


     



 


 

  1. Read Pending Files from collection Object and Assign Current File Name in to SourceFile Variable



 


 



 

  1. Assign Variable Name in to Source File Connection

    Note: If you assign only the Variable Name in the Connection String then it will work in Development Environment. It won't work in Production. So specify the File Path With \\



     


     


     

    I Hope this will Help you to Read Files from folder Using Script component Source and do the looping over the files using For Each Loop.


     

Read Files From Folder

 A) Create String Variable “SourcePath” for the Source Folder and Assign Value C:\DatFiles\Pending
B) Select Script Component from Transformation Control and choose the “Source Option” and
Edit Script component and set Read Only Variable like here.


1.       Create OutPut Columns and set the datatype to hold the Out put rows
3    a) Read File Names from Folder using VB.Net or C#.NET
public override void CreateNewOutputRows()

      {



               

        string folderPath = "";

        // Asign Package Variable Path to local Variable

        folderPath = Variables.SourcePath;

        DirectoryInfo dir = new DirectoryInfo(folderPath);

        if(dir.Exists)

        {

            if (dir.GetFiles().Length > 0)

            {

                FileInfo[] dirFiles = dir.GetFiles();

                foreach (FileInfo fiInfo in dirFiles)

                {

                    SourceFilesBuffer.AddRow();

                    SourceFilesBuffer.FileName = fiInfo.Name;

                    SourceFilesBuffer.CreatedDate = fiInfo.CreationTime;

                }

            }           

        }    

b) Write OutPut in to OLEDB Table like step 1. B)


4.       A) Create Source File and Pending Files Variables for Load Current Filename  and Hold All Filenames Respectively
b) Select Source Filenames from OLEDB Table and Assign Rows into PendingFiles Object Variable
Using Execute SQL Task Editor

Please refer the URL….



5.       Read Pending Files from collection Object and Assign Current File Name in to SourceFile Variable



6.       Assign Variable Name in to Source File Connection
Note: If you assign only the Variable Name in the Connection String then it will work in Development Environment. It won’t work in Production. So specify the File Path With \\



I Hope this will Help you to Read Files from folder Using Script component Source and do the looping over the files using For Each Loop.



Monday, February 1, 2010

MDX - Top 10 and Others


WITH

SET [top 10] AS

TopCount
(

[Product].[Product Name].[Product Name].MEMBERS
,10

,[Measures].[Spend]

)

// MEMBER [Product].[Product Name].[Others] AS

// Aggregate([Product].[Product Name].[Product Name].MEMBERS - [top 10])

// OR



MEMBER [Product].[Product Name].[Others] AS

Aggregate(EXCEPT([Product].[Product Name].[Product Name].MEMBERS,[top 10]))





SET [Top 10 AND rollup] AS

{

[top 10]

,[Product].[Product Name].[Others]

}

SELECT

{[Measures].[Spend]

,[Measures].[Spend Ratio Over Product]

} ON COLUMNS
,{[Top 10 AND rollup]} ON ROWS [FactPurchase]

FROM