cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
acepeda
Helper III
Helper III

Patch Text string in OptionSet column?

Hi, can anyone help me with this?...

I need to patch all records from a Gallery that contains Text column only (from excel import collection) and i haven´t found the correct syntax to patch some of these text columns in the target OptionSets Dataverse columns.

 

This is my current code, in bold the wrong syntax

 

ForAll(Gallery2.AllItems,

Patch(RecordsFromExcel, Defaults(RecordsFromExcel),

{AssgnTo: ThisRecord.'Assign to',

FlStatus: ThisRecord.'Flow Status',

SAP: ThisRecord.'SAP ',

OrdrStatus: ThisRecord.'Order Status',

OrdrType: OrderType_Choices.??????

Name: "FromExcel"&"-"&Now()}))

 

Thanks in advance for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @acepeda,

Do you want to patch a text string from the Gallery to the OptionSets value in Dataverse table?

 

Actually, if you want to add a text string to the OptionSets(Choices) column in Dataverse, I am afraid that there is no way to achieve this in Power Apps currently.

The OptionSets(Choices) column expects an option set type value, which is totally different from the text string in the Gallery.

 

As a workaround, you could consider using an If statement to match the option set value with the text string in the Gallery. 

ForAll(Gallery2.AllItems,

Patch(RecordsFromExcel, Defaults(RecordsFromExcel),

{AssgnTo: ThisRecord.'Assign to',

FlStatus: ThisRecord.'Flow Status',

SAP: ThisRecord.'SAP ',

OrdrStatus: ThisRecord.'Order Status',

OrdrType: Switch(ThisRecord.TextColumn,"Text1",OptionSetName.Option1,"Text2",OptionSetName.Option2,...)

Name: "FromExcel"&"-"&Now()}))
Best Regards,
Qi

View solution in original post

2 REPLIES 2
v-qiaqi-msft
Community Support
Community Support

Hi @acepeda,

Do you want to patch a text string from the Gallery to the OptionSets value in Dataverse table?

 

Actually, if you want to add a text string to the OptionSets(Choices) column in Dataverse, I am afraid that there is no way to achieve this in Power Apps currently.

The OptionSets(Choices) column expects an option set type value, which is totally different from the text string in the Gallery.

 

As a workaround, you could consider using an If statement to match the option set value with the text string in the Gallery. 

ForAll(Gallery2.AllItems,

Patch(RecordsFromExcel, Defaults(RecordsFromExcel),

{AssgnTo: ThisRecord.'Assign to',

FlStatus: ThisRecord.'Flow Status',

SAP: ThisRecord.'SAP ',

OrdrStatus: ThisRecord.'Order Status',

OrdrType: Switch(ThisRecord.TextColumn,"Text1",OptionSetName.Option1,"Text2",OptionSetName.Option2,...)

Name: "FromExcel"&"-"&Now()}))
Best Regards,
Qi

Hi Qi, thanks so much for your help.

It works!.

Regards,


Alex

 

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,971)