Variables and Script component as a source

  • Hello all,

    I have an integer variable in my package called DaysToRun. I need to use this variable in a script component as a source to create the number of rows in the variable. Unfortunately I can only use the variable in the postexecute which is useless to me. How can I create a dataflow in the script component when I need the variable to determine how many rows to create?

    Thanks,

    Strick

  • Strick,

    I'm not clear on what you're trying to do here. Could you post some more information about what you're trying to accomplish?

    hth,

    Tim

  • Hi thanks for your response,

    Sure, basically I have a variable called DaysToRun which will be supplied externally. This variable will be responsible telling the script componend (as a source) the number of days to create which will be used in a subsequent task. So, what I'm looking to take the variable and loop the number of times of the variable while adding some date information to the OutputRows.

    I have no issues with doing this. The problem I'm having is that the script component will only let you use variables in the PostExecute section which is after the OutPutrows process has run.

    Thanks,

    Strick

  • What happens when you define the variable you want to use in the ReadOnlyVariables property? You should not have problems reading variables before output rows. Only writing to variables will probably impose the limitation to access only in PostExecute.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Hi, unfortunately whether it's read or write won't matter. I'll still get the error stating this must be done in the PostExecute section.

    Strick

  • stricknyn (10/31/2009)


    Hi, unfortunately whether it's read or write won't matter. I'll still get the error stating this must be done in the PostExecute section.

    Strick

    Do not set ReadOnlyVariables property. Then use the base class VariableDispenser member to LockForRead -> Get Value -> Unlock .

    Let us know how it goes.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply