【发布时间】:2017-10-17 15:15:37
【问题描述】:
我希望在 QGIS 中创建一个依赖于另一个字段中包含的数据的新字段。
我正在使用字段计算器和 case 函数,但它似乎出于某种原因试图将我的条件字符串拉为字段!
看起来像这样 - 我正在尝试根据现有的 LEASE 字段(其值为 Interested 或 Toronto)创建一个新字段。
CASE
when LEASE Like "Interested" or "Toronto" then "Participating"
Else "Non-Participating"
End
我得到的错误是
未找到感兴趣的列
有什么想法吗?
【问题讨论】:
-
双引号用于分隔标识符,例如
"ColumnName"。对字符串文字使用单引号,例如'Interested'. -
... when LEASE IN ('Interested', 'Toronto') then... -
感谢您的帮助 - 但是,当我以这种方式更新时,它现在显示“无法将 'Toronto' 转换为布尔值”。编辑:Jarlh 的上述功能解决了这个问题。
-
这就是为什么你应该改用
IN (...)。
标签: sql case field calculator qgis