mardi 7 juillet 2020

Powerapps Combine SortByColumns AddColumns GroupBy and If conditions

I am building a powerapp to facilitate the submission of comments in Excel. I need to combine two formulas. The first one uses SortByColumns, AddColumns, GroupBy and the second one are If statments that will filter the result of the first one depending on which entry has been selected in the drop-down menus.

The first drop down menu includes a list of clients and the second menu a list of resources.

enter image description here

The first formula on the Gallery Items is as follows:

SortByColumns(
    AddColumns(
        GroupBy(
            clientcomment,
            "ClientName",
            "Comments"
        ),
        "LastUpdateDate",
        Text(
            Max(
                Comments,
                UpdateDate
            ),
            "[$-en-GB]dd/mm/yyyy"
        )
    ),
    "LastUpdateDate",
    Descending,
    "ClientName",
    Ascending
)

The second formula, which I want to combine with the above code is as follows:

SortByColumns(
    If(
        CCGrByDSMDD.Selected.Result = "All" And CCGrByClientDD.Selected.Result = "All",
        clientcomment,
        CCGrByDSMDD.Selected.Result = "All" And CCGrByClientDD.Selected.Result <> "All",
        Filter(
            clientcomment,
            ClientName = CCGrByClientDD.Selected.Result
        ),
        CCGrByDSMDD.Selected.Result <> "All" And CCGrByClientDD.Selected.Result = "All",
        Filter(
            clientcomment,
            DSM = CCGrByDSMDD.Selected.Result
        ),
        CCGrByDSMDD.Selected.Result <> "All" And CCGrByClientDD.Selected.Result <> "All",
        Filter(
            clientcomment,
            DSM = CCGrByDSMDD.Selected.Result And ClientName = CCGrByClientDD.Selected.Result
        )
    ),
    "UpdateDate",
    Descending,
    "ClientName",
    Ascending
)

How do I combine the two formulas?

Aucun commentaire:

Enregistrer un commentaire