我有以下困境。。。
数据以BIT
的形式存储在SQL中,即1或0。
我的工作表中的我的参数由用户定义,即是或否。
当参数检查时,它显然会用以下代码进行检测:
let
//Pull in a values from the parameter table
SQL = fnGetParameter("SQL"),
dbName = fnGetParameter("DB"),
ValuationDate = Text.From(fnGetParameter("Valuation Date")),
ActiveItem = Text.From(fnGetParameter("Active Items")),
if ActiveItem = "No" then "1" else "0"
Source = Sql.Database(SQL, dbName,
[Query="
我面临的问题是,我如何在高级编辑器中编写/开发以将"是/否"切换为1/0?
我用以下代码尝试了一下(也可以在上面看到(:
if ActiveItem = "No" then "1" else "0"
这可能吗?
经过一番努力,我终于把它做好了。
我更改了我的get参数:
ActiveItem = Text.From(fnGetParameter("Active Items")),
收件人:
ActiveItem = Text.From(if fnGetParameter("Active Items") = "Yes" then 1 else 0),
这很有魅力。
我的最终代码如下:
let
//Pull in a values from the parameter table
SQL = fnGetParameter("SQL"),
dbName = fnGetParameter("DB"),
ValuationDate = Text.From(fnGetParameter("Valuation Date")),
ActiveItem = Text.From(if fnGetParameter("Active Items") = "Yes" then 1 else 0),
Source = Sql.Database(SQL, dbName,
[Query="