Forum Discussion

AGo's avatar
AGo
Post Patron
8 years ago
Solved

Parameter 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 ...
  • ImkeF's avatar
    ImkeF
    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