• kpmandani (12/4/2016)


    Not only just to determine the number of rows in the text file but based on the count, it should determine (and send) that same text file as an email.

    So, if the count of rows is greater than 1, it should send that text file, if not, don't send it

    OK. Part 1 is the rowcount.

    Create a Boolean 'SendFile' variable in your package.

    Add a Script Task, with the above variable listed in the 'Read/Write Variables' list.

    Your code will look something like this (untested):

    int count = 0;

    bool SendFile = false;

    string line;

    TextReader reader = new StreamReader("file.txt");

    while ((line = reader.ReadLine()) != null)

    {

    count++;

    if (count > 1)

    SendFile = true

    break;

    }

    reader.Close();

    //Set the value of your package variable here

    Once you have the Boolean variable populated, I assume you know how to use precedence constraints to control the logic flow?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.