如何检查是否选择了选择字段选项

时间:2018-09-21 11:45:33

标签: sharepoint-list powerapps powerapps-formula powerapps-selected-items

在PowerApps表单中,提交按钮的DisplayMode由公式确定,该公式检查所有必填字段是否已完成。

If (
    And(
        Or(DPIAForm.Mode=FormMode.Edit,DPIAForm.Mode=FormMode.New),
        Not IsBlank(TitleField.Text),
        Not IsBlank(DescOfInitiativeField.Text),
        DateRaisedField.SelectedDate <> Date(
            1900,
            01,
            01
        ),
        Not IsEmpty(PersonalDataChoiceField.SelectedItems.Value),
        Not IsEmpty(SpecialCatChoiceField.SelectedItems.Value),
        Not IsEmpty(ChildrensDataChoiceField.SelectedItems.Value),
        Not IsEmpty(CriminalChoiceDataField.SelectedItems.Value),
        Not IsEmpty(SourcesOfDataChoiceField.SelectedItems.Value),
        Not IsEmpty(NumberOfIndividualDataSubjectsChoiceField.SelectedItems.Value),
        Not IsEmpty(LawfulBasisChoiceField.SelectedItems.Value),
        Not IsBlank(ProviderField.Text),
        Not IsEmpty(NewTechnologyChoiceField.SelectedItems.Value),
        Not IsEmpty(DataEvaluatedOrScoredChoiceField.SelectedItems.Value),
        Not IsEmpty(DecisionsMadeAutomaticallyChoiceField.SelectedItems.Value),
        //Not IsBlank(KindofDecisionsMadeAutomaticallyField.Text),
        If(DecisionsMadeAutomaticallyChoiceField.SelectedItems.Value ="Yes", Not IsBlank(KindofDecisionsMadeAutomaticallyField.Text), "" ),
        Not IsEmpty(IndividualNotAwareOfPersonalDataCaptureChoiceField.SelectedItems.Value),
        Not IsEmpty(DataTransferredOutsideEEAChoiceField.SelectedItems.Value),
        Not IsBlank(WhoWillHaveAccessToDataField.Text),
        Not IsEmpty(MonitoringIndividualsChoiceField.SelectedItems.Value),
        Not IsEmpty(CriminalChoiceDataField.SelectedItems.Value),
        Not IsEmpty(MonitoringIndividualsChoiceField.SelectedItems.Value),
        Not IsEmpty(DataRetentionPlanChoiceField.SelectedItems.Value),
        Not IsBlank(RetentionPlanForPersonalDataField.Text),
        Not IsBlank(RetentionPlanForSensitiveDataField.Text),
        Not IsBlank(RetentionPlanForChildrensDataField.Text),
        Not IsBlank(RetentionPlanForCriminalConvictionDataField.Text),
        Not IsEmpty(SupplierDueDiligenceDoneChoiceField.SelectedItems.Value),
        Not IsEmpty(GDPRCompliantContractWithAll3rdPartiesChoiceField.SelectedItems.Value),
        StatusDataField.Text = "Draft"
        ),
    DisplayMode.Edit,
    DisplayMode.Disabled)

我们遇到麻烦的部分是中间的公式:

    If(DecisionsMadeAutomaticallyChoiceField.SelectedItems.Value ="Yes", Not IsBlank(KindofDecisionsMadeAutomaticallyField.Text), "" ),

在这里,我要测试是否用户在下拉/选择字段ecisionsMadeAutomaticallyChoiceField中选择了“是”,如果是,则字段KindofDecisionsMadeAutomaticallyField不得为空白/空启用提交按钮...

但是我在If(DecisionsMadeAutomaticallyChoiceField.SelectedItems.Value ="Yes"

上收到错误无效的参数类型

我也尝试过:

If(DecisionsMadeAutomaticallyChoiceField.SelectedItems(1)

那么在我们的公式中执行此操作的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

我发现答案是要检查通过以下方式选择

if("Value" in ComboBox.SelectedItems.Value, 
Not IsBlank(TextDataField.Text), IsBlank(TextDataField.Text) ),

所以在我看来,正确的公式是:

if("Yes" in DecisionsMadeAutomaticallyChoiceField.SelectedItems.Value, 
Not IsBlank(KindofDecisionsMadeAutomaticallyField.Text), 
IsBlank(KindofDecisionsMadeAutomaticallyField.Text) ),