Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Collection missing data from source

(1) ShareShare
ReportReport
Posted on by 276
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:
  • Suggested answer
    STS1SS Profile Picture
    STS1SS 276 on at
    Collection missing data from source
     
    Well, this issue raised its head again today.
     
    I realized I was not properly creating the collection.
     
    All on me.
     
    Thanks for your help.
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Collection missing data from source
    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.
  • STS1SS Profile Picture
    STS1SS 276 on at
    Collection missing data from source
    @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
    WarrenBelz 145,434 on at
    Collection missing data from source
    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    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Collection missing data from source
    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
     
  • STS1SS Profile Picture
    STS1SS 276 on at
    Collection missing data from source
     
    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
    WarrenBelz 145,434 on at
    Collection missing data from source
    Hi @STS1SS,
    What  is the code (in Text please) for setting varSelectedCompany in both apps ?

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,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard