Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
My source is SQL server and database have different password for different environment.
I am trying to handle the ODBC connection dynamically.
I am using below script:
if (wildmatch (v_compName,'100-BIQVW-D*') then
ODBC CONNECT TO $(vODBC) (XUserId is NYOOWIRNJbaCEEBKNKYEHaVV, XPassword is TOSJTQBNQLbCGZROdF)
else if (wildmatch (v_compName,'100-BIQVW-T*') then
ODBC CONNECT TO $(vODBC) (XUserId is VPXPcIRNJbaCEEBKNKYEHadS, XPassword is BXVQJJVMNbbMXSVJFbbB)
else if (wildmatch (v_compName,'100-BIQVW-P*') then
ODBC CONNECT TO AHP_PRD (XUserId is VbcAQIRNJbaCEEBKNKYEHaZc, XPassword is BTCDcQBNQLbCGZROZE)
else if (wildmatch (v_compName,'SBYCSQLSCLNT01*') then
ODBC CONNECT TO $(vODBC) (XUserId is NYOOWIRNJbaCEEBKNKYEHaVV, XPassword is TOSJTQBNQLbCGZROdF
end if
end if
end if
end if
But this is not working.
Can anyone please help me.
Thanks,
Sarif
Both are allowed by the Script syntax spec. The only difference is that ELSEIF doesn't need repeated END IF statement terminators. An IF with multiple ELSEIF clauses is still a single statement, while ELSE IF starts a new statement, leading to nested IF blocks that each must be terminated.
So you may want to adjust your example code.
Tres, QV11.20 allows for isolated END IF keywords (as many as you like and wherever you like), but 12.xx gives an error message for your three superfluous END IF terminators. And the message is really informative:
"The control statement is not correctly matched with its corresponding start statement
END IF"
We were warned that QV12 was going to be more strict about script syntax... ![]()
I could remember faintly, that I used both in some earlier version. But with new qlix engine (QV 12.1) I could not use "else if". I guess, you meant for the older version, right (may be QV 11.2 as you mentioned in the below post)?
You can use ELSE IF but not on the same line. This
IF var = 1 THEN
LET Othervar = 'One';
ELSE IF var = 2 THEN
LET Othervar = 'Two';
END IF
END IF
doesn't work in 12.xx, but this one
IF var = 1 THEN
LET Othervar = 'One';
ELSE
IF var = 2 THEN
LET Othervar = 'Two';
END IF
END IF
does.
Also apparently this one doesn't work in v12 anymore, while it used to work in 11.20.
IF var = 1 THEN
LET Othervar = 'One';
ELSEIF var = 2 THEN
LET Othervar = 'Txo';
END IF
END IF
yes...but I am getting error now.
