这是否考虑在 Powerapps canvas-app 函数中进行硬编码?

Is this consider hardcoding in Powerapps canvas-app functions?

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

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

根据您的第一次编辑(您拥有完整的表达方式,而不仅仅是简化版本),这绝对可以改进。回答主要问题 - 是的,表达式在不需要的地方对 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 statements seem to come directly from the conditions in the 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_))