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

Replace the Text Values in a Comma-Separated String With New Number Values While Retaining the Sting Datatype?

I am working on a Flow where I have an array and I use a Join action to create a comma-separated string.  This string has values that must be converted to a format that will work in Dataverse while retaining the string data type.  This is a test flow for proof of concept as the actual source will not be a hard-coded array but dynamic data from a SP list choice mult-select column (I just used 3 of the values from that SP column).  

Convert an array to a str then replace text with numbers.png

So  the flow worked and produced this string: Bid Manager,Solution Consultant,Proposal Manager. 

Now I need to convert each of the three text values with a number (e.g., "Bid Manager" should be converted to 198260000, "Solution Consultant" to 198260001, and "Proposal Manager" to 198260002) the Dataverse equivalent for those choices in that column. 

How do I replace the values in the string with their respective numbers and retain it as the same comma-separated string so the new string = 198260000,198260001,198260002?  

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Super User
Super User

One way to do this is to use a "lookup" table.

 

(1) You could create a JSON object that maps the strings to their Dataverse option values:

Snag_95be4a.png

 

(2) Use a Select action to "lookup" the option values:

Snag_9995b0.png

(3) Then finally join the output from the Select action using a comma:

Snag_964627.png

Here is the sample runtime output:

Snag_971c34.png

 

Hope this helps:


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
ekarim2020
Super User
Super User

One way to do this is to use a "lookup" table.

 

(1) You could create a JSON object that maps the strings to their Dataverse option values:

Snag_95be4a.png

 

(2) Use a Select action to "lookup" the option values:

Snag_9995b0.png

(3) Then finally join the output from the Select action using a comma:

Snag_964627.png

Here is the sample runtime output:

Snag_971c34.png

 

Hope this helps:


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

@ekarim2020 - Ellis thanks so much for this great solution!  I appreciate you taking the time to respond. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,171)