这是否考虑在Powerapps canvas应用功能中进行硬编码?

时间:2018-12-12 01:38:19

标签: powerapps powerapps-formula

下面是我写的内容,请问是否可以将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_)))

1 个答案:

答案 0 :(得分: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_))