0

I am trying to drop columns so I can get my browse gallery working properly. However my formula is not working properly.

I get error:

There is an error in this formula. Try revising the formula and running it again

Formula I am using:

If(
    Toggle2.Value = false,
    DropColumns(
    SortByColumns(
        AddColumns(
            Filter(
                [@'Documentation Tracker'],
                Or(Lower(Requestor_two) = Lower(User().Email), Lower(Approver.Value) = Lower(User().Email)) && TextSearchBox1.Text in Title
            ),
            "Doc_TypeValue", Doc_Type.Value, "ApprovalStatusValue", 'Approval Status'.Value, "AutomationTypeValue", 'Automation Type'.Value, "ApproverValue", Approver.Value
        ), 
        If(Dropdown1.Selected.Value = "Documentation Type", "Doc_TypeValue", Dropdown1.Selected.Value = "Requestor", "Requestor_two", Dropdown1.Selected.Value = "CAATT ID", "Title", Dropdown1.Selected.Value = "Status", "ApprovalStatusValue", Dropdown1.Selected.Value = "Automation Type", "AutomationTypeValue", Dropdown1.Selected.Value = "Approver", "ApproverValue", Dropdown1.Selected.Value = "Approval Date", "RequirementsApprovalDate",Dropdown1.Selected.Value = "CAATTS Name", "CAATTsName", "ID"),
        Ascending
    ),
    SortByColumns(
        AddColumns(
            Filter(
                [@'Documentation Tracker'],
                TextSearchBox1.Text in Title
            ),
            "Doc_TypeValue", Doc_Type.Value, "ApprovalStatusValue", 'Approval Status'.Value, "AutomationTypeValue", 'Automation Type'.Value, "ApproverValue", Approver.Value
        ),
        If(Dropdown1.Selected.Value = "Documentation Type", "Doc_TypeValue", Dropdown1.Selected.Value = "Requestor", "Requestor_two", Dropdown1.Selected.Value = "CAATT ID", "Title", Dropdown1.Selected.Value = "Status", "ApprovalStatusValue", Dropdown1.Selected.Value = "Automation Type", "AutomationTypeValue", Dropdown1.Selected.Value = "Approver", "ApproverValue", Dropdown1.Selected.Value = "Approval Date", "RequirementsApprovalDate",Dropdown1.Selected.Value = "CAATTS Name", "CAATTsName", "ID"),
        Ascending
        ),
    "Doc_TypeValue")
)

1 Answer 1

1

Use this formula, it should work for you:

If(
    Toggle2.Value = false,
    DropColumns(
        SortByColumns(
            AddColumns(
                Filter(
                    [@'Documentation Tracker'],
                    Or(Lower(Requestor_two) = Lower(User().Email), Lower(Approver.Value) = Lower(User().Email)) && TextSearchBox1.Text in Title
                ),
                "Doc_TypeValue", Doc_Type.Value, "ApprovalStatusValue", 'Approval Status'.Value, "AutomationTypeValue", 'Automation Type'.Value, "ApproverValue", Approver.Value
            ), 
            If(Dropdown1.Selected.Value = "Documentation Type", "Doc_TypeValue", Dropdown1.Selected.Value = "Requestor", "Requestor_two", Dropdown1.Selected.Value = "CAATT ID", "Title", Dropdown1.Selected.Value = "Status", "ApprovalStatusValue", Dropdown1.Selected.Value = "Automation Type", "AutomationTypeValue", Dropdown1.Selected.Value = "Approver", "ApproverValue", Dropdown1.Selected.Value = "Approval Date", "RequirementsApprovalDate",Dropdown1.Selected.Value = "CAATTS Name", "CAATTsName", "ID"),
            Ascending
        ),
        "Doc_TypeValue", "ApprovalStatusValue", "AutomationTypeValue", "ApproverValue"
    ),
    DropColumns(
        SortByColumns(
            AddColumns(
                Filter(
                    [@'Documentation Tracker'],
                    TextSearchBox1.Text in Title
                ),
                "Doc_TypeValue", Doc_Type.Value, "ApprovalStatusValue", 'Approval Status'.Value, "AutomationTypeValue", 'Automation Type'.Value, "ApproverValue", Approver.Value
            ),
            If(Dropdown1.Selected.Value = "Documentation Type", "Doc_TypeValue", Dropdown1.Selected.Value = "Requestor", "Requestor_two", Dropdown1.Selected.Value = "CAATT ID", "Title", Dropdown1.Selected.Value = "Status", "ApprovalStatusValue", Dropdown1.Selected.Value = "Automation Type", "AutomationTypeValue", Dropdown1.Selected.Value = "Approver", "ApproverValue", Dropdown1.Selected.Value = "Approval Date", "RequirementsApprovalDate",Dropdown1.Selected.Value = "CAATTS Name", "CAATTsName", "ID"),
            Ascending
        ),
        "Doc_TypeValue", "ApprovalStatusValue", "AutomationTypeValue", "ApproverValue"
    )
)

Documentation: AddColumns, DropColumns, RenameColumns, and ShowColumns functions in Power Apps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.