Passing where condition from Power Query to PostgreSQL, Stuck in the last step

kuldeepjain

New member
Joined
Nov 21, 2012
Messages
1
Reaction score
0
Points
1
Location
India
Excel Version(s)
Excel 365
I have a working solution in power query and wanted to add a dynamic where a clause passes from the power query itself. followed the approach shared at "https://powergi.net/2020/05/17/dynamic-sql-queries-with-excels-power-query/". Reached up to the last step where the source query step needs to modify for combined test string as where condition but at this step, the error is encountered as

"DataSource.Error: PostgreSQL: 42601: syntax error at or near "and"
Details:
DataSourceKind=PostgreSQL
DataSourcePath=XXXXXXXXX
Message=42601: syntax error at or near "and"
ErrorCode=-2147467259

my query which is unable to pass the string is
" Value.NativeQuery(PostgreSQL.Database("XXXXXXXXX"), "Select product_family9 , sr_date2 ,shipment_date_manufa28 ,diagnose_code1_descr16 ,diagnose_code2_descr18 from appuser.failure"&WhereClause)"

Whereclause is the combined string to be passed in the native query. Pls, help.
 

Attachments

  • Image.jpg
    Image.jpg
    105.7 KB · Views: 2
Back
Top