cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
s_galligan
Frequent Visitor

How to combine a choice and a text value in a collection

Hi,

I am trying to create a collection by combining the word "All" and the values of a Choice. The list of values in the collection should be "All", "New", "In Progress", "Solved", "Closed". I have been able to add the values of the Choice as shown underneath. 

ClearCollect(TicketFilter, Choices(JobStatus).Value);

TicketFilter.png

I have tried amending the code to add "All" at the start but this causes an error.

ClearCollect(TicketFilter,{Value :"All"});
Collect(TicketFilter, Choices(JobStatus).Value); 

Error message.png

I've tried numerous edits to the code but have not been able to get this to work. Can anyone offer any assistance? Any help would be much appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @s_galligan

 

It works well with Sharepoint but not Dataverse. As a workaround, we can loop through the list

ClearCollect(
    TicketFilter,
    {Value: "All"}
);
ForAll(
    Choices(JobStatus).Value,
    Collect(
        TicketFilter,
        {Value: Text(ThisRecord.Value)}
    )
)

 

StalinPonnusamy_0-1639683589082.pngStalinPonnusamy_1-1639683601236.png

 


Thanks,
Stalin - Learn To Illuminate

View solution in original post

4 REPLIES 4
StalinPonnusamy
Super User
Super User

Hi @s_galligan 

 

ClearCollect(TicketFilter, {Value: "All"}, Choices(SPList.ColumnName))

Example
ClearCollect(TicketFilter, {Value: "All"}, Choices(IssueTracker.Status))


Thanks,
Stalin - Learn To Illuminate 

Thanks for replying @StalinPonnusamy. Unfortunately that hasn't worked so let me provide some additional clarification. The Choice I have is called "JobStatus" and it was created within Powerapps as shown in the images below. I am trying to combine these values with "All" to form a collection.Choice1.png

Choice2.png

Hi @s_galligan

 

It works well with Sharepoint but not Dataverse. As a workaround, we can loop through the list

ClearCollect(
    TicketFilter,
    {Value: "All"}
);
ForAll(
    Choices(JobStatus).Value,
    Collect(
        TicketFilter,
        {Value: Text(ThisRecord.Value)}
    )
)

 

StalinPonnusamy_0-1639683589082.pngStalinPonnusamy_1-1639683601236.png

 


Thanks,
Stalin - Learn To Illuminate

Thank you @StalinPonnusamy, that worked perfectly. I had spent the last 2 days trying to figure this out so I'm extremely grateful for your help. 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,515)