cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

AddColumns referring to item in the filter the AddColumns is attached to

So I need to show a table of forthcoming documents to be reviewed by the logged in user. Simply, any document with the reviewer's name on it (SharePoint list), where its start date is in the next 3 weeks, needs to appear. This filter works fine (feel free to suggest better ways of coding this!). Each document goes through multiple stages (2A, 2B,2C,3A ... 5C).

 

As I need to add in display columns not in the SP list, I am using AddColumns to achieve this. I have 3 display columns I need to show which I add. 

 

The problem I am facing is that each row can be at a different stage (2C or whatever), and the added columns need to show the correct StartDate etc. for that particular row. My logic to achieve this is separated from the item in that row, and I find my logic is buggy and sometimes gets it wrong. 

 

If I was able to get the 'identifier' out of the filter part of the code, and use that to populate the correct dates in the added columns then all would be good.

 

For instance, if the record in the filter comes out of the "Planned Start Date 2B" section, I would only want to show the "Planned Start Date 2B" in the added column.

 

Cut down version of code, where the added columns are using assumptions about the dates to decide which date goes in each row.

 

 

Sort(
    AddColumns(
        Filter(
            DocumentsTable,
            ('Planned Start Date 2B' > Today() && 'Planned Start Date 2B' <= DateAdd(
                Today() + 1,
                21,
                Days
            ) && Lower(Authoring) = CurrentUser) || ('Planned Start Date 3B' > Today() && 'Planned Start Date 3B' <= DateAdd(
                Today() + 1,
                21,
                Days
            ) && Lower(Authoring) = CurrentUser)
        ),
        "PlannedStartDate",
        If(
            'Planned Start Date 2B' < Today(),
            'Planned Start Date 3B',
            'Planned Start Date 2B'
        ),
        "PlannedEndDate",
        If(
            'Planned End Date 2B' < Today() || 'Planned Start Date 2B' < Today(),
            'Planned End Date 3B',
            'Planned End Date 2B'
        ),
        "WhatToDo",
        If(
            'Planned End Date 2B' < Today(),
            "3B",
            "2B"
        )
    ),
    PlannedStartDate,
    Ascending
)

 

 

Actual App. It is a table control:

 

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,955)