
Announcements
I have a table that pick up records in a SharePoint library. Is it possible to use the content type in a combo box to pick up the names of the content type used in the library. I have the following in the Items property which seems to have values but no display name.
TemplateTable.'{ContentType}'
Hi @Ianhall1892 ,
According to your description, I made a test for you.
By using the formula [ TemplateTable.'Content Type'.Name ], power apps will report an error.
I am afraid that powerapps does not support this data type now.
However, If you create a collection for TemplateTable.'Content Type', the value of ‘Name’ can be seen in collection.
So, I suggest you create a table that records the relationship between ‘Id’ and ‘Name’.
Then use filter() function to filter the records by ‘Id’ through this relationship between ‘Id’ and ‘Name’.
For example:
1\ This is my test document library. I named it 'AABBCCDDEE'.
2\ I create a collection for the test document library. There are 2 content types in it.
Create a button and set its onselect property to:
ClearCollect(AAA,ForAll( Distinct(AABBCCDDEE,'Content type'.Id),LookUp(AABBCCDDEE,'Content type'.Id=Result).'Content type')) //AAA is my collection name
//Choose file – collections .you will see this table and see their names.
3\ So ,I create a relationship list for 'Id' and 'Name'. I named it 'TestA'. ‘Id’ and ‘Name’ are one to one relationship. Each record is a content type in your document library. In my test document library ‘AABBCCDDEE’, I have two content types of Items, so I created two records.
It is worth noting that in different document libraries, the same content type of Id is different.
If you have less than five types(<=5 😞
3.1 Create 2 fields.’Id’ and ‘Name’
3.2 Through my collection, I know that I have Items of content type 'Summary Task', so I input its Id and Name into the Id Field and Name Field in ‘TestA’. // You can create a gallery to display ‘content type’ ‘s Id and copy it.
3.3 Through my collection, I know that I have Items of content type 'Document', so I input its Id and Name into the Id Field and Name Field in ‘TestA’.
3.4 This is my ‘TestA’
If you have more than five types(>5 😞
You can use LastN() function on collection. Like this:
LastN(ClearCollect(AAA,ForAll( Distinct(AABBCCDDEE,'Content type'.Id),LookUp(AABBCCDDEE,'Content type'.Id=Result).'Content type')),5)
4\ Add a combo box control 'ComboBox2' and set its Items property to:
TestA
5\ Add a gallery control and set its Items property to:
Filter(AABBCCDDEE,'Content type'.Id=ComboBox2.Selected.Id)6\ The result is as follows:
Best Regards,
Wearsky