cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

"ShowColumns" fetching all columns in collection

Hi All,

 

I am fetching data from an Azure SQL Server into a PowerApps Collection. To ensure that this is dynamic, I am using the method which is mentioned in this link .

 

My Azure SQL Table has 40 columns whereas I need to select only a few columns into the canvas app. While using the method in the link above, I add an additional step of adding ShowColumns, in addition to filtering the data, but somehow, all the columns get added to the collection and data gets filled for the two columns that I add in ShowColumns -

Set(
    firstRecord,
    Min(
        SQLTable,
        New_ID
    )
);
Set(
    lastRecord,
    Max(
        SQLTable,
        New_ID
    )
);
Set(
    iterationsNo,
    RoundUp(
        (lastRecord - firstRecord) / 500,
        0
    )
);
ClearCollect(
    TestCollection1,
    Sequence(
        iterationsNo,
        0
    )
);
ForAll(
    TestCollection1,
    With(
        {
            prevThreshold: Value(Value) * 500,
            nextThreshold: (Value(Value) + 1) * 500
        },
        If(
            lastRecord > Value,
            Collect(
                TestCollection,
                ShowColumns(
                    Filter(
                        SQLTable,
                        New_ID > prevThreshold && New_ID <= nextThreshold
                    ),
                    "New_ID",
                    "Account_ID"
                )
            )
        )
    )
);

 

 

 

I tested adding a simple collection and it fetched only two columns into the collection -

 

ClearCollect(TestCollect_A,ShowColumns(SQLTable,"New_ID","Account_ID"))

 

 

How do I ensure that I get only 2 columns into the collection? I have set the "Explicit Column Selection" setting to "True" as well.

 

Please advice!

0 REPLIES 0

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,377)