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!
Solved! Go to Solution.
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
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
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
I need to convert values of a few more columns so not sure how this would work
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:
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
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
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
This worked! Just what i was looking for - thank you
User | Count |
---|---|
93 | |
45 | |
20 | |
20 | |
15 |
User | Count |
---|---|
134 | |
53 | |
44 | |
37 | |
31 |