Reply
Level: Powered On
Posts: 21
Registered: ‎09-20-2017

entity collection

[ Edited ]

I have two questions about collections.


1)What is the correct syntax on creating a collection from more than one field in an entity. I have three fields I want to add ot my collection. 

CableNumber, CableFrom, FromDescription. 

I'm getting it wrong

What I've been doing is this format:

(ClearCollect(CableFrom,('Cable From'.CableNum),('Cable From'.CableFrom),('Cable From'.FromDescription)))
and so the first value, CableNum gets populated. But the other two fields don't.

I'm guessing it's because I created this collection incorrectly


2) How would one create a collection as a subset of another collection, using my above example how would i say something like CreateCollection(CableNumber, CableFrom, FromDescription.) where CableNumber=1

3) How would be the best way to find a specific record in a collection and populate a label with the value found in that record/field?

thanks for all your help so far.

Level: Powered On
Posts: 33
Registered: ‎02-27-2017

Re: entity collection

Hi,

 

1) and 2):

ClearCollect(NewCollection,ShowColumns(Filter(OriginalCollection, CableNumber = 1),"CableNum","CableFrom","FromDescription")

 

3):

Label.Property(Default or something) = LookUp(Collection, field = value, ReturnColumn)

 

Hopefully this helps. 

Level: Powered On
Posts: 21
Registered: ‎09-20-2017

Re: entity collection

[ Edited ]

Thanks for your help.
You say your solution is the same for 1) and 2) but I have to create my first collection

     ClearCollect(TestOnly,('Cable From'.CableNum),('Cable From'.CableFrom),('Cable From'.FromDescription));

 

where Collection=TestOnly, and the entity='Cable From' with these three fields

So this collection is created but for some reason only the 'FromDescription' field is populated, though on confirmation there is data in all three fields.

 

I'm hoping it's in the design of the testonly collection where this is occuring. 
____________________________________________________________
FOLLOW UP : Tried the same thing with a different collection, different entity and 3 fields from that entity - I see the same behavior. So maybe I'm developing multi field collections using the wrong syntax?

Level: Powered On
Posts: 33
Registered: ‎02-27-2017

Re: entity collection

So let's check this again,

you want to have your TestOnly colleciton filled with one specific record from the entity "Cable From"?

This specific record only returns three specific fields?

 

I'm trying to understand of we're on the same page or not Smiley Very Happy

 

Level: Powered On
Posts: 21
Registered: ‎09-20-2017

Re: entity collection

Thanks for responding.  I think I've figured it out. regarding my last entry,i kept thinking why was i missing data when creating a collection because it wouldonly show just dat from one fielld. When I hooked it into the form, i was able get the lookup's to work. Thanks very much for your help.  My love/hate relationship with powerapps continues (more love).

Highlighted
Level: Powered On
Posts: 21
Registered: ‎09-20-2017

Re: entity collection

I think i'm hitting inconsistencies and due to my ramping up in powerApp, I run into inconsistencies.

This is a sample of the data I'm working with. I created a Collection from it, 
     ClearCollect(Deviced,(Devices.Device),(Devices.DeviceType),(Devices.DeviceDescription),(Devices.PrimaryId));
I checked the collection for data and each field shows values 

Helptext1.JPG

 

I then created a form, and wanted to show data depending on which Device was chosenHelptext2.JPG. Depending on device, show result in description and Device Type

 

 

 

 

my trouble is that I cannot get the description and devicetype to show any values.

 

In populating the description as an example, i tried the following 2 code snippets.

NOTE: source_DT is the field to the right of the Device Search in Red, gettng data from the drop down - 


1)                   Text = LookUp('Deviced', Device=Source_DT.Text, DeviceDescription

2)                   Text = LookUp(Deviced,  Source_DT.Text in Device, DeviceDescription) 


Nothing is appearing in Description. 

So my question is what am I doing wrong?