Forum Discussion
Text.Contains with underscore
Hi there,
I'm working with the Power Query editor right now.
I have a table connected to my database, and I need to apply a parameter in my request to get some values, else I get an error of query (this is ok).
So I've created a text type parameter which help me to get values in my table.
but when this parameter contains an underscore, the request fails, as if the underscore split my parameter.
Is there any way to include the underscore in the parameter to have my good results please ?
Here is 2 examples :
- WORKS : Table.SelectRows(dbo_AnalogHistory, each Text.Contains([TagName], "AAA.BBB.CC"))
- FAILS : Table.SelectRows(dbo_AnalogHistory, each Text.Contains([TagName], AAA_BBB_CC))
Thanks.
Hi Anonymous and thanks for answering !
Fortunately, I found an other way to get my data, using a direct Query with the parameter in the WHERE clause like this :
Source = Sql.Database("xxx", "yyy", [Query = "SELECT * FROM [Runtime].[dbo].[History] WHERE [Name] like '%"&ParamName&"%'"])
Thanks for trying to help 🙂
Now my other problem which I can't find a solution is this one :
Here is the solution :
2 Replies
- AnonymousNot applicable
Hi ChainSpart
What kind of database are your trying to connect to?
Can your parameter without any symbol like"A","B" or with other symbols like dot succeed to filter your table?
Will you get any message when you use the parameters with underscore?
If it is possible, you can show me the screenshot about your issue and show me your M code in Advance Editor.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- ChainSpartFrequent Visitor
Hi Anonymous and thanks for answering !
Fortunately, I found an other way to get my data, using a direct Query with the parameter in the WHERE clause like this :
Source = Sql.Database("xxx", "yyy", [Query = "SELECT * FROM [Runtime].[dbo].[History] WHERE [Name] like '%"&ParamName&"%'"])
Thanks for trying to help 🙂
Now my other problem which I can't find a solution is this one :
Here is the solution :