Forum Discussion
SBK
9 years agoNew Contributor
If we run the jdbc step in a loop, we are establishing the connection and disconnecting it for each SQL Statement right??
nmrao
9 years agoCommunity Hero
Yes, I believe so.
If you want to avoid that, then use groovy script.
If you want to avoid that, then use groovy script.
- SBK9 years agoNew Contributor
In below code sample, it is not going into If statement, Please correct me if I am doing something wrong.
DBFL = [CQ, 789, J34]
RSFL = [J34 , 789 ]DB = DBFL.size()
RS = RSFL.size()for (j=0;j<DB;j++)
{
for (k=0;k<RS;k++)
{
if (DBFL[j] == RSFL[k])
{
log.info DBFL[j]
log.info RSFL[k]
assert DBFL[j] == RSFL[k]
}
}
}- nmrao9 years agoCommunity HeroWhat are you trying to do? Please provide the context.
You want assert if both arrays/lists equal? - nmrao9 years agoCommunity Hero
Here you go:
def DBFL = ['CQ', '789', 'J34'] def RSFL = ['J34' , '789'] assert DBFL.sort() == RSFL.sort()
- groovyguy9 years agoCommunity Hero
I managed to tweak your code a little to make it work. I added quotation marks around the valuesi n the DBFL and RSFL arrays you created.
DBFL = ["CQ", "789", "J34"] RSFL = ["J34" , "789"] DB = DBFL.size() RS = RSFL.size() for (j=0;j<DB;j++) { for (k=0;k<RS;k++) { if (DBFL[j] == RSFL[k]) { log.info DBFL[j] log.info RSFL[k] assert DBFL[j] == RSFL[k] } } }