Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

DropColumns issues shaping Dynamic Collection

(0) ShareShare
ReportReport
Posted on by 179

Hello, PowerApps Geniuses

 

This has been driving me insane the last few days trying to figure out if it's a PowerApps bug or what... 

 

I have a master table that I am trying to reshape using DropColumns (I've also tried AddColumns etc.) but there are multiple variables determining which columns are being dropped. This is so straightforward, I have tried If, Switch, and Combinations of every conceivable table manipulation but I keep getting the same issue. The final table still shows the columns that were dropped when I choose different variables that control the input of said table... (the columns are empty as they are not pulling data, but they still exist when they have been "dropped". 

 

Is this a known issue? I have tried ClearCollect, Set, using the items of a dummy gallery...  Is there some sort of Schema issue when you use the same table name but switch out the contents using If statements and variables?? 

 

Please, I really hope someone has some sort of thoughts on this... 

 

Frustrated and annoyed!

 

 

Categories:
  • TO-24090852-0 Profile Picture
    TO-24090852-0 2 on at
    DropColumns issues shaping Dynamic Collection
    I have as similar issue where I would like to drop certain columns if a respective checkbox is unchecked.
  • LeeB_CDN Profile Picture
    LeeB_CDN 179 on at
    Re: DropColumns issues shaping Dynamic Collection

    Hi @v-dezhili-msft 

     

    Thanks for your response! Unfortunately, this problem persists whether I use ShowColumns or DropColumns... If you are using ClearCollect on the same collection name, it's like there is a Schema memory that keeps the previous column titles from the last collection to that name... I have seen similar posts with this issue and no one seems to have a solution...

  • Re: DropColumns issues shaping Dynamic Collection

    Hi @LeeB_CDN ,

     

    Please try to use ShowColumns(), you just need to extract the columns you need.

     

    thumbnail_image.png

    Best Regards,

    Dezhi

  • LeeB_CDN Profile Picture
    LeeB_CDN 179 on at
    Re: DropColumns issues shaping Dynamic Collection

    Nobody has any ideas? @RandyHayes @mdevaney @WarrenBelz ? This seems like a good one for you guys... 

  • LeeB_CDN Profile Picture
    LeeB_CDN 179 on at
    Re: DropColumns issues shaping Dynamic Collection

    Here is some context to show what is happening, here are two code snips showing the ClearCollect functions: 

     

    ClearCollect(colExcelMergedFinalExport,
    If(
    varExcelAssignColVis, DropColumns(varExcelMergedExport, "Branch Inventory", "Admin Name", "Admin Email", "Admin Phone", "Admin Department", "Admin Job Title", "Admin Manager", 
    "Job Number", "Job Supervisor Name", "Job Supervisor Email", "Job Supervisor Phone", "Job Supervisor Department", "Job Supervisor Title", "Job Supervisor Branch", 
    "Repair Location", "Repair Status",
    "Monitor Make", "Monitor Make Other", "Monitor Model", "Monitor Model Other", "Monitor Status", "Monitor Serial", "Monitor Service Date",
    "Harness Make", "Harness Make Other", "Harness Size", "Harness Status", "Harness Serial", "Harness Service Date",
    "Lanyard Make", "Lanyard Make Other", "Lanyard Size", "Lanyard Status", "Lanyard Serial", "Lanyard Service Date",
    "Self-Retracting Lanyard Make", "Self-Retracting Lanyard Make Other", "Self-Retracting Lanyard Size", "Self-Retracting LanyardStatus", "Self-Retracting Lanyard Serial", "Self-Retracting Lanyard Service Date",
    "Anchor Sling Quantity", "Anchor Sling One Status", "Anchor Sling One Service Date", "Anchor Sling Two Status", "Anchor Sling Two Service Date",
    "Lock Box Quantity", "Pad Lock Quantity", "Cable Lock Quantity", "Breaker Lock Quantity", "Scissor Lock Quantity",
    "Arc Flash Suit Assigned", "Arc Flash Suit Rating", "Arc Flash Suit Serial", "Arc Flash Hood Assigned", "Arc Flash Hood Rating", "Arc Flash Hood Serial", "Arc Flash Gloves Assigned", "Arc Flash Gloves Rating", "Arc Flash Gloves Serial", "Arc Flash Gloves Service Date",
    "Ear Muffs Make", "Ear Muffs Make Other", "Ear Muffs Model", "Ear Muffs Model Other",
    "Bump Station Make", "Bump Station Make Other", "Bump Station Model", "Bump Station Model Other", "Bump Station Status", "Bump Station Serial", "Bump Station Service Date",
    "Tablet Make", "Tablet Make Other", "Tablet Status", "Tablet Model", "Tablet Model Other", "Tablet Asset ID")
    ));
    
    ClearCollect(colExcelMergedFinalExport,
    If(
    varExcelPersMonColVis, DropColumns(varExcelMergedExport, 
    "User Name", "User Branch", "User Email", "User Phone", "User Department", "User Job Title", "User Manager", 
    "Branch Inventory", "Admin Name", "Admin Email", "Admin Phone", "Admin Department", "Admin Job Title", "Admin Manager",
    "Job Number", "Job Supervisor Name", "Job Supervisor Email", "Job Supervisor Phone", "Job Supervisor Department", "Job Supervisor Title", "Job Supervisor Branch", 
    "Repair Location", "Repair Status",
    "Harness Make", "Harness Make Other", "Harness Size", "Harness Status", "Harness Serial", "Harness Service Date",
    "Lanyard Make", "Lanyard Make Other", "Lanyard Size", "Lanyard Status", "Lanyard Serial", "Lanyard Service Date",
    "Self-Retracting Lanyard Make", "Self-Retracting Lanyard Make Other", "Self-Retracting Lanyard Size", "Self-Retracting LanyardStatus", "Self-Retracting Lanyard Serial", "Self-Retracting Lanyard Service Date",
    "Anchor Sling Quantity", "Anchor Sling One Status", "Anchor Sling One Service Date", "Anchor Sling Two Status", "Anchor Sling Two Service Date",
    "Lock Box Quantity", "Pad Lock Quantity", "Cable Lock Quantity", "Breaker Lock Quantity", "Scissor Lock Quantity",
    "Arc Flash Suit Assigned", "Arc Flash Suit Rating", "Arc Flash Suit Serial", "Arc Flash Hood Assigned", "Arc Flash Hood Rating", "Arc Flash Hood Serial", "Arc Flash Gloves Assigned", "Arc Flash Gloves Rating", "Arc Flash Gloves Serial", "Arc Flash Gloves Service Date",
    "Ear Muffs Make", "Ear Muffs Make Other", "Ear Muffs Model", "Ear Muffs Model Other",
    "Bump Station Make", "Bump Station Make Other", "Bump Station Model", "Bump Station Model Other", "Bump Station Status", "Bump Station Serial", "Bump Station Service Date",
    "Tablet Make", "Tablet Make Other", "Tablet Model", "Tablet Status", "Tablet Model Other", "Tablet Asset ID")
    ));

     

    The first If statement drops all columns except the Date Assigned and User columns from the list based on varExcelAssignColVis being 'true'. Here is the result of the first ClearCollect of colExcelMergedFinalExport:

     

    Screen Shot 2022-12-02 at 6.41.59 PM.png

    The second If statement drops all columns except the Date Assigned and Personal Monitor columns from the list based on varExcelPersMonColVis  being 'true'. Here is the result of the second ClearCollect of colExcelMergedFinalExport:

    Screen Shot 2022-12-02 at 6.43.41 PM.png

    As you can see, the User columns reappear in the new iteration of colExcelMergedFinalExport even though they are clearly listed in the DropColumns function!!! This is insanity!!

     

    Can anyone explain this behaviour and how to stop this from happening.... I have tried adding a Clear(colExcelMergedFinalExport); function on top of the ClearCollect... I am at my wits end... 

     

    I need to be able to dynamically reduce the master table to a final table for export to excel... based on user input to show/hide columns of preferred data... And am prepared to manually create all of the possible If scenarios but cannot overcome what appears to me, to be a major flaw or bug in how PowerApps handles tables.

     

    Thanks in advance for reading and hopefully someone, somewhere knows SOMETHING about this strange issue... 

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard