Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I need to load my data from 2 different datasources by made of an external flag; I wrote an external TXT file where I stored a number which indicates the firm.
My external Ditta.txt file contains only:
SET Ditta=0;
or
SET Ditta=1;
In the script I used;
$(include=Ditta.txt);
So I have the value 0 for the first firm or the value 1 for the second one in the variable Ditta and then I need to use it to redirect the ODBC, but I'm not able to do it.
Can someone help me, please?
Thanks.
N.
IF $(Ditta) = 0 THEN
Connection String for Ditta=0 // ODBC .....
ELSE
Connection String for Ditta=1 // ODBC .....
ENDIF
Edit : corrected syntax
IF $(Ditta) = 0 THEN
Set vConnect = 'Your 0 connection string';
ELSE
Set vConnect = 'Your 1 connection string';
END
ODBC CONNECT TO $(vConnect);
Rather than using the include file to set a flag, followed by logic in the model to interpret the flag, why not simplify things by putting the connection string in the include file instead (one per include file)?
Oh, and I would use must_include instead of include, so that a missing include file causes an error in the correct place, rather some obscure later error caused by the missing include file.
IF $(Ditta) = 0 THEN
Connection String for Ditta=0 // ODBC .....
ELSE
Connection String for Ditta=1 // ODBC .....
ENDIF
Edit : corrected syntax
Thank you for the reply; closing the instruction with END it returns a syntax error; I used ENDIF and it works properly 🙂
Thank you for the suggestion; I have to make a little modification to my scripts to apply everywhere!!
Yeah, that was syntax error. Btw, I have edited my response. Thanks for marking it as correct.