web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Dynamically convert te...
Power Automate
Answered

Dynamically convert text to number - help

(0) ShareShare
ReportReport
Posted on by 61

Hi All

 

I need to convert a choice value (string) from a sharepoint list to a number for input into dataverse.

 

I need this to be dynamic,  for example, Business Analyst would be converted to 899400000 and Senior Business Analyst would be converted into 899400001 etc etc. Then the converted number would but mapped to a row input. 

 

I know I can use a condition and compose for this, but this would be a ton of conditions running in parallel for all my choices. 

 

Is there an easier way to do this, maybe using a variable or something else?

 

Help welcome please!

Categories:
  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @Gofunk1 

    Could be possible to create a SharePoint list like this?

    Title RoleID
    Business Analyst 899400000
    Senior Business Analyst 899400001

    You could use the "Get Item" SharePoint action with an Odata filter expression to search for items (based on the "Title" column) within the list and get the "RoleID" value.

    Hope it helps!

    Ferran

  • nocodecreative.io Profile Picture
    61 on at

    I dont think that wouldn't work or I'm not understanding how to do it. Here is the flow as it stands, does this make more sense.

     

    I'm trying to reduce the amount of conditions I would need as I have a number of choices to convert

     

    Gofunk1_0-1639407070471.png

     

  • nocodecreative.io Profile Picture
    61 on at

    I need to convert values of a few more columns so not sure how this would work

  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @Gofunk1 

    In my sample you have 2 SharePoint lists: NewEmployees (where the item is created) and RolesMapping (where you have the mapping between the Role and the ID (the table I shared with you before). Then, you could create something like this:

    1) When an item is created in NewEmployees list

    2) Search in the RoleMapping list for the Role Title

    3) Get the role ID (first returned row), using the following expression:

    first(outputs('get_items'))?['RoleID']

    The flow would like this:

    roles.png

     So you have a "master" table, which maps the Role Title with the Role ID, and more fields could be mapped. In this way, you don't need to create different if actions.

    The last compose action gets the Role ID, so the field value you should enter when creating the record in the dataverse table.

    Hope it helps!

    Ferran

  • nocodecreative.io Profile Picture
    61 on at

    Thanks I'll try this, but before I do, is there a way to chain a bunch of expressions, for example, see below, how would I get the compose to do an "or operation so I can enter another If statement?

     

    I cant do

    if(equals(outputs('Compose'), 'Business Analyst'),'899400000','no')
    OR
    if(equals(outputs('Compose'), 'Senior Business Analyst'),'899400001','no')

     

    Gofunk1_0-1639409393875.png

     

  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at

    You should do something like this:

    if(equals(outputs('Compose'), 'Business Analyst'),'899400000',if(equals(outputs('Compose'), 'Senior Business Analyst'),'899400001','0'))

    In the expression to apply when the condition is false, you should add another if, and so on...

    Regards,

    Ferran

  • nocodecreative.io Profile Picture
    61 on at

    This worked! Just what i was looking for - thank you 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 430

#2
11manish Profile Picture

11manish 341 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 282

Last 30 days Overall leaderboard