Forum Discussion
AGo
Post Patron
8 years agoParameter changing datasource type DB2->ODBC
Hi, I have this M code and trying to return the TABLE1 table for conditionally 2 datasources (ODBC and DB2) which has the same structure. I'm not good at M: I think that the third row generates ...
- 8 years ago
Hi AGo,
in M, every query step can be seen as a variable. So your requirement can be solved like this:
let Odbc = Odbc.DataSource("dsn=dsnname", [HierarchicalNavigation=true]), DB2 = DB2.Database("servername", "test", [Implementation="IBM"]), Origine = if para = "ODBC" then Odbc else DB2 in Origine
Greg_Deckler
Community Champion
8 years agoInvoking ImkeF
ImkeF
Community Champion
8 years agoHi AGo,
in M, every query step can be seen as a variable. So your requirement can be solved like this:
let
Odbc = Odbc.DataSource("dsn=dsnname", [HierarchicalNavigation=true]),
DB2 = DB2.Database("servername", "test", [Implementation="IBM"]),
Origine = if para = "ODBC" then Odbc else DB2
in
Origine- AGo8 years ago
Post Patron
Works like a charm! And thanks forthe functioning explaining.