February 8, 2017 at 4:20 pm
I have a package,where it has for each loop.it will load each state information ( eg - FL,CA etc)
- In the loop the first step is creating the conenction with encrypt and decrypt tool once succeded next step is it will insert a record in load table with ID here the result set is ID based on paramters from first component the second component result set will give the ID. when we insert a record for first state.
Created a variable at package level - ID as Int32.
Now I need this ID in stored procedure which is outside of loop. How can i get first id from the package?
February 8, 2017 at 7:47 pm
Create a variable to store the value and then pass it?
February 9, 2017 at 5:41 am
Already created the variable and assigning into result set
But my question is it loops 13 times..to bring all states information how to track the first state id into that variable?
By default it will be last state id in the variable when the loop ends right? But i am looking to capture the very first id.
February 9, 2017 at 5:48 am
mcfarlandparkway - Thursday, February 9, 2017 5:41 AMAlready created the variable and assigning into result setBut my question is it loops 13 times..to bring all states information how to track the first state id into that variable?
By default it will be last state id in the variable when the loop ends right? But i am looking to capture the very first id.
Variables don't get 'assigned into result sets', so I'm not sure what you mean by that.
Create another variable and use an expression to assign its value from the existing variable on the first iteration only.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
February 9, 2017 at 6:42 am
Any syntax for the expression, Not sure how to write the code in expression.
Can I get an example of the code.
February 9, 2017 at 7:43 am
mcfarlandparkway - Thursday, February 9, 2017 6:42 AMAny syntax for the expression, Not sure how to write the code in expression.Can I get an example of the code.
This is really not that advanced. Here is some pseudo code, please try implementing it and post back with any questions.
If (LoopCounter == 1)
Variable2 = LoopVariable
Obviously, you need to define and increment the LoopCounter variable in your loop to make this work.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
February 9, 2017 at 8:09 am
What is this variable 2 and loop variable?
Variable2 = LoopVariable
do we need to define these two at package level? or variable 2 is existing variable which I already have that are storing all the id's ?
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply