web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection missing dat...
Power Apps
Suggested Answer

Collection missing data from source

(1) ShareShare
ReportReport
Posted on by 307
I have two apps in the same environment. Both use a dropdown to select a record from a table 'Accounts' that will then filter the table 'Sites' to return only the necessary records. One works fine, and one does not.
 
Both return the appropriate records from 'Sites' to the collection, but the one I am working on today only returns two columns of data. Yes I checked the data is in the table.
 
Both use the following code, it is identical in both apps...
 
ClearCollect(colCompanySites, Filter(Sites, ParentAccount = varSelectedCompany.'Account Name'))
 
 
Must be obvious, but I cannot see it.
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,494 Most Valuable Professional on at
    Hi @STS1SS,
    What  is the code (in Text please) for setting varSelectedCompany in both apps ?
  • STS1SS Profile Picture
    307 on at
     
    First, if this helps: Working app returns a record with various columns containing data. Not working app returns a record with the same various columns, but only data is in GUID and NAME. All the other data is empty. Same environment, same data source. Both are set in the ONCHANGE property of the respective combo boxes.
     
    WORKING APP:
    If(IsBlank(cmbSearchCompanies.Selected),"",Set(varSelectedCompany, cmbSearchCompanies.Selected))
     
    NOT WORKING APP:
    Set(varSelectedCompany, cmbAccount.Selected)
     
    The difference is in the two combo boxes. Here is the code in the ITEMS property:
     
    WORKING:
    Sort(
        Filter(
            Search(Accounts, cmbSearchCompanies.SearchText, 'Account Name'),
            SiteYN = false && Active && "Customer" in Text('Business Type')
        ),
        'Account Name',SortOrder.Ascending
    )
     
    NOT WORKING:
    Sort(Filter('4655 Accounts',Active),'Account Name',SortOrder.Ascending)
     
     
    In writing the response I'm trying to anticipate where you're going and I see a difference in the items code. This might be inconsequential, but I am at a loss as to why in the working app I can reference the table by its schema name, and in the other I am forced to use the display name. Could that somehow be related, and regardless, why would this be? My thinking here is to not have some giant, bloated, do everything app, with all features of the solution in one... is that a mistake?
     
    Thanks for looking
  • WarrenBelz Profile Picture
    154,494 Most Valuable Professional on at
    So I have this clear, the example not working has a Combo Box cmbAccount (I assume single selection) with the Items
    Sort(
       Filter(
          '4655 Accounts',
          Active
       ),
       'Account Name',
       SortOrder.Ascending
    )
    Assuming Active is a Boolean field here, that should make all fields in the selected record available.
    After selection, you do this
    Set(varSelectedCompany, cmbAccount.Selected)
    which should set the Variable to the (full) selected record
    You then do this
    ClearCollect(
       colCompanySites, 
       Filter(
          Sites, 
          ParentAccount = varSelectedCompany.'Account Name'
       )
    )
    and you are saying that the returned records are missing fields ? Please confirm this and also as a debugging exercise, try this
    ClearCollect(
       colCompanySites, 
       Filter(
          Sites, 
          ParentAccount = cmbAccount.Selected.'Account Name'
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
     
  • WarrenBelz Profile Picture
    154,494 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • STS1SS Profile Picture
    307 on at
    @WarrenBelz Unfortunately, I've had to table this for the moment.

    What you last replied is accurate (your assumptions), and when I try the suggested code, the data is still missing. To be clear, what I mean is the columns appear, but no data. EG: I can see the 'AccountName' and GUID data, but it returns no other data.

    In the meantime, it occurred to me I was adding an unnecessary step. I do not need to retrieve any account info for this. Each Account has multiple locations I call 'Sites'. This is really what I want, so I've deprecated that combobox anyway. The question still remains. My updated combobox (just the datas ource changed in the code from 'Account' to 'Sites'. It works fine. I'm lost on this one.

    While on the subject of datasources/collections I have another question though... Any idea why a collection does not appear in my data tab, nor in the dropdown for data source selection EG: as the source for items in a combobox? This is true regardless the environment or app. I had no idea I should see a collection as a data source until I viewed Power Drag and Drop video from Scott Durow. 
  • WarrenBelz Profile Picture
    154,494 Most Valuable Professional on at
    A collection should "appear" the same as any other Table providing you can see it in your resources. If you are using Modern controls however, there are still bugs in many of these, so it is a bit hard to comment.
  • Suggested answer
    STS1SS Profile Picture
    307 on at
     
    Well, this issue raised its head again today.
     
    I realized I was not properly creating the collection.
     
    All on me.
     
    Thanks for your help.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard