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
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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