根据您进行的第一次编辑(您拥有整个表达式,而不仅仅是简化版本),这绝对可以改进。要回答主要问题 - 是的,表达式是对in
表达式中不需要的值进行硬编码。
例如,看一下这个表达式的开头:
If(
"EC - Empire Complex" in BuildingDropdown.Selected.Value &&
"Storey 1" in StoreyDropdown.Selected.Value &&
"Office" in AreaNameDropdown.Selected.Value,
Distinct(
Filter(
Area,
"1" in buildingID,
"Storey 1" in storey_x0020_,
"Office" in areaName_x0020_),
areaDescription_x0020_),
If(
"EC - Empire Complex" in BuildingDropdown.Selected.Value &&
"Storey 1" in StoreyDropdown.Selected.Value &&
"Meeting rooms" in AreaNameDropdown.Selected.Value,
Distinct(
Filter(
Area,
"1" in buildingID,
"Storey 1" in storey_x0020_,
"Meeting rooms" in areaName_x0020_),
areaDescription_x0020_),
If(
"EC - Empire Complex" in BuildingDropdown.Selected.Value &&
"Storey 1" in StoreyDropdown.Selected.Value &&
"Pantry" in AreaNameDropdown.Selected.Value,
Distinct(
Filter(
Area,
"1" in buildingID,
"Storey 1" in storey_x0020_,
"Pantry" in areaName_x0020_),
areaDescription_x0020_),
// And many more lines
语句中的表达式Filter
似乎直接来自If
子句中的条件,因此可以直接在其中使用:
If(
"EC - Empire Complex" in BuildingDropdown.Selected.Value,
Distinct(
Filter(
Area,
"1" in buildingID,
StoreyDropdown.Selected.Value in storey_x0020_,
AreaNameDropdown.Selected.Value in areaName_x0020_),
areaDescription_x0020_))