Created
March 29, 2018 19:29
-
-
Save ImkeF/c8676c747a0e9ff6197d27efacf51708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let func = | |
(Server as text, Database as text, SQLTable as text, SQLColumn as text, FilterList as list) => | |
let | |
/* Debug parameters | |
Server = "localhost", | |
Database = "postgres", | |
SQLTable = "public.mytesttable", | |
SQLColumn = "Col1", | |
FilterList = Filter[Column1], | |
*/ | |
FilterString= "'"&Text.Combine(List.Distinct(FilterList),"','")&"'", | |
Result = PostgreSQL.Database(Server, Database, [Query="SELECT * FROM "& SQLTable &" WHERE "& SQLColumn &" In ("& FilterString &")"]) | |
in | |
Result , | |
documentation = [ | |
Documentation.Name = " Table.InnerJoinForSQLFolding ", | |
Documentation.Description = " Performs an inner join on a sql table with a non-sql-source that will fold. To be used as filter only, as none of the non-SQL columns can be expanded. ", | |
Documentation.LongDescription = " Performs an inner join on a <code>SQLTable</code> with a non-sql-source that will fold. To be used as filter only, as none of the non-SQL columns can be expanded. <code>Server</code>, <code>Database</code>, <code>SQLTable</code> and <code>SQLColumn</code> to be passed as text and the <code>FilterList</code> as list (column from a table). ", | |
Documentation.Category = " Table ", | |
Documentation.Source = " local ", | |
Documentation.Author = " Imke Feldmann: www.TheBIccountant.com . ", | |
Documentation.Examples = {[Description = " ", | |
Code = " ", | |
Result = " "]}] | |
in | |
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment