0

下面是我写的,我可以知道canvas-app函数是否被认为是硬编码的......:

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_)))
4

1 回答 1

0

根据您进行的第一次编辑(您拥有整个表达式,而不仅仅是简化版本),这绝对可以改进。要回答主要问题 - 是的,表达式是对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_))
于 2018-12-12T14:46:36.560 回答