Forum Discussion
Insert Parameter in M language
- Anonymous8 years ago
Hi All,
So after many variations, it turns out it's the same as VBA without spaces. I was building a Paramaeterised Query and wanted a single place to change the value and it update the 6 Queries I have.
The Date value appeared like this "201801", so I created a variable and then managed to insert that using ""&Date&""
All working, thanks for you help. :)
Hi Anonymous Thank you for your reply. I have tried your code. Which is returning as List(please see screenshot)
but not table data.
and i got the output as one line like the below text in Blue color
SELECT * FROM 'TheValueinParameter'.'Function2'();
I tried below code:
let
SchemaVersion = SName,
YourQuery = "SELECT * FROM '"&SName&"'.'Function2'();",
QueryName = AnalysisServices.Database(CName, SName, [Query=YourQuery])
in
YourQuery
//Cname: is the parameter for ServerName i have created
//Sname: is the Schema Name that is used in select statement.By above code atleas I am able to get the value inside the paramerter Sname. That raises a hope that this is possible some how. Could you please look into this ? Thanks
let
SchemaVersion = SName,
YourQuery = "SELECT * FROM '"&SName&"'.'Function2'();",
QueryName = AnalysisServices.Database(CName, SName, [Query=YourQuery])
in
YourQuery << Should be QueryName
//Cname: is the parameter for ServerName i have created
//Sname: is the Schema Name that is used in select statement.So in your above code, you have YourQuery as the IN, it should be the last step, QueryName
- Anonymous7 years agoNot applicable
Anonymous Almost there!. Code works perfectly only one thing need to fix, which i am unable to figure out. Please see the screenshot below. I have marked up everything. This code is appending the server name with SName as well. I tried to remove the SName variable from
QueryName = AnalysisServices.Database(CName, SName, [Query=YourQuery])
But it leads to error. Could you please look into below image:
Thanks, Kulchandra
- ImkeF7 years ago
Community Champion
The image you've posted is not an error-message, but a warning. If you click "Run", you should either get the desired result or an error-message. Please post that error-message if you need further help on that.
- Anonymous7 years agoNot applicable
Thanks ImkeF , an honour to have you posting in the same thread! Thanks for all the effort you put in. :smileyhappy: