cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Connor55
Resolver I
Resolver I

Collect Record from combobox selection

Hi!  I'm trying to collect a record from a selected record in a combobox with this:

 

Collect(PullSheetCollection, InventorySearch.Selected)

 

I have an entity called "Inventories" that's the source of a combobox "InventorySearch" - and I'm using a collection called "PullSheetCollection."

The issue, is when I run the collect function it's only collecting the record from the column that's displayed in the combobox - not the entire record.  My collection actually has all of the columns from the entity in the combobox, but the only one getting filled is the Commercial_Name column - which is what is displayed in the combobox.  

 

Any ideas?  

1 ACCEPTED SOLUTION

Accepted Solutions

After some more searching I found someone with a similar problem - I think it was a new feature added.  You just have to turn off Explicit Column Selection.  

Screen Shot 2020-01-23 at 9.30.11 AM.png

Thanks to @v-siky-msft
He solved this in the original case I found. 

View solution in original post

12 REPLIES 12
mdevaney
Super User
Super User

@Connor55 

I would use a LOOKUP formula to reference the original table and pull the record from there instead.

Collect(
    PullSheetCollection,
    LookUp(your_datasource_name, ID = InventorySearch.Selected.ID)
)

 

If this does not work the next step would be to show me the code in the Items property of the InventorySearch ComboBox.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney I tried the lookup function - no errors, but it's not collection anything.

Collect(PullSheetCollection, LookUp(Inventories, Bar_Code = InventorySearch.Selected.Bar_Code))

 

I just have my ComboBox's items set to the entity, "Inventories"

@Connor55 

Could you please try to REFRESH your connection by going to the left-side menu, clicking on the datasource, then Refresh?  I am wondering if changes to the datasource could be the cause of both your problems.

@mdevaney I tried the refresh and it's seeing all of the columns to collect, but it's not actually collection the selected item's data.  

 

I solved the other issue by going to an older version.  I have no idea why it broke - the formula and all the arguments stayed the same.  

 

 

@Connor55 

Hmmm... can you create a label and try these in the Text property?  Let me know if there is any result.  For the 2nd code snippet replace "type a valid barcode here" with a known good barcode.

 

LookUp(Inventories, Bar_Code = InventorySearch.Selected.Bar_Code, Bar_Code)
LookUp(Inventories, Bar_Code = "type a valid barcode here", Bar_Code)

 

 

Is your datasource SharePoint?  If yes, what is the column type for BarCode? (e.g. Text, Number, LookUp, etc).

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

@mdevaney The first function came up empty - which explains the issue.  The 2nd came out fine.

 

It's a CDS data source.  I actually have two Barcode columns, one is type text and the other number.  I just created the text version to help troubleshoot.  

@Connor55 

CDS is not my specialty but...

 

Maybe what the most recent test tells us is there is a data type mismatch of some sort.  Text can only be compared to Text and Numbers can only be compared to Numbers.

 

So its a total guess but maybe converting the information in your ComboBox to another data type will do the trick.  Try this again in a label using my 2 ideas below.

LookUp(Inventories, Bar_Code = Value(InventorySearch.Selected.Bar_Code), Bar_Code)
LookUp(Inventories, Bar_Code = Text(InventorySearch.Selected.Bar_Code,"0"), Bar_Code)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney This is weird.  It seems like I'm unable to reference certain columns.  HOWEVER, I discovered once I create a label with InventorySearch.Selected.Column  - that specific column will then work in the lookup function.  

 

It's still only collection the fields it's already seen though.  For example, I have the Commercial Name field referenced in the combobox, the InStock field in another input control - those fields get collected.  Once I created the label with the barcode text field, it then collected it.  I then created another label with my Manufacturer field - it then collected that column. 

 

This might be a good case to report to Microsoft - this seems like a bug.  

@Connor55 

Bizzare, yes report the issue to MS.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,123)