2015-11-04 55 views
0

我有以下代碼:將價值分配到電源的查詢字符串

let 
    Condition = Excel.CurrentWorkbook(){[Name="test_table"]}[Content], 
    field = Condition{0}[field_excel], 
    str = "One", 
    query = if field <> null 
     then str = "two" 
     else str = "three", 
    exec= Oracle.Database("TESTING", [Query=str]) 
in 
    exec 

我想這取決於條件strtwothree價值,但總是與One

回答

1

你想留做這樣的事情:

... 
field = Condition{0}[field_excel], 
str = if field <> null then "two" else "three", 
exec = Oracle.Database("TESTING", [Query = str]), 
... 

Power Query不允許你重新賦值給一個變量在一個let表達。相反,您可以將該值分配給一個新變量。

+0

它的工作!謝謝! –