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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,563)