cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RomanP
Frequent Visitor

Collection AddColumns - CountRows

Hello,

 

I´m facing a problem while trying to add a new column to a collection.

For this column I want to subtract the count of child records from a value saved in the database.

 

Hardcoding the GUID in the filter works just fine:

ClearCollect(
    col_raeume,
    [@Raeume]
);
ClearCollect(
    col_raeume_plaetze,
    AddColumns(
        col_raeume,
        "Freie Plaetze",
        ThisRecord.Plaetze - CountRows(
            Filter(
                [@Raumbuchungen],
                ThisRecord.Raum.Raum = GUID("493934b3-7514-ec11-b6e6-000d3ab19038")
            )
        )
    )
);

 

But instead of this fixed GUID I have to compare "ThisRecord.Raum.Raum" with the GUID outside of the filter.

With the GUID of the row in the collection "col_raeume"

"ThisRecord" in the filter refers to the table "Raumbuchungen" inside the filter. How do I get one layer higher?

 

I already found this post but it´s not working for me.

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Super User
Super User

@RomanP ,

I think that As operator will save the day 🙂...

ClearCollect(
    col_raeume,
    [@Raeume]
);
ClearCollect(
    col_raeume_plaetze,
    AddColumns(
        col_raeume As temp_col_raeume,
        "Freie Plaetze",
        Plaetze - CountRows(
            Filter(
                [@Raumbuchungen],
                Raum.Raum = temp_col_raeume.Raum.Raum
            )
        )
    )
);

It's just a though.

Hope it helps !

View solution in original post

2 REPLIES 2
gabibalaban
Super User
Super User

@RomanP ,

I think that As operator will save the day 🙂...

ClearCollect(
    col_raeume,
    [@Raeume]
);
ClearCollect(
    col_raeume_plaetze,
    AddColumns(
        col_raeume As temp_col_raeume,
        "Freie Plaetze",
        Plaetze - CountRows(
            Filter(
                [@Raumbuchungen],
                Raum.Raum = temp_col_raeume.Raum.Raum
            )
        )
    )
);

It's just a though.

Hope it helps !

View solution in original post

Thank you very much. It indeed saved the day 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,199)