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

"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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,495)