cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Serviced2000
Helper II
Helper II

IF Expression Not Working

Hi Everyone,

 

I have a cascading IF statement that looks like this :

 

If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150000), 'Australian Citizen',
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150001), 'NZ Citizen'
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150002), 'Australian Perm Resident'
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150003), 'AU Working Holiday',
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150004), 'Temporary Resident',
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150005), 'Finite / FinXL Sponsored',
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150006), '457 Visa (Non Finite Group',
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150007), 'Aboriginal or Torres Strait Islander',
If(equals(outputs('Get_Placement_Record')?['body/fc_visastatus'], 948150008), 'Other Visa''No Visa / Not Recorded')))))))))
 
The challenge is that it always collapses to the default value - 'No Visa / Not Recorded' even when the output of this section :
 
outputs('Get_Placement_Record')?['body/fc_visastatus']
 
Is 948150000 (for example). I have tested the outputs and this should give me a result of 'Australian Citizen'. What makes this even stranger is that I am using this exact same expression to populate a table elsewhere in my solution and that works perfectly. There are no intellisense errors or suggestions from the authoring canvas either.
 
Can anyone see what I've done wrong here?
 
Thanks!
1 ACCEPTED SOLUTION

Accepted Solutions

Hi Prasad,

 

I did, but it was down to user error. I used an expand query to get all the data into my flow but didn't quite understand how many 'hops' I needed to make to get to the data item I needed. Where I had this in my expression:

 

body/fc_visastatus

 

I should have had an extra step, like this:

 

body/contact/fc_visastatus

 

Once I added that in it worked just as it was supposed to.

 

Thanks again for all your help!

View solution in original post

7 REPLIES 7
ScottShearer
Super User III
Super User III

@Serviced2000 

I suggest the following:

  1. Delete the expression
  2. Copy it for where it is working and paste it where you deleted the expression
  3. Save and test

 

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

Scott
PrasadAthalye
Super User
Super User

Wrap the numbers in single quotes... See below example...

 

If(equals(variables('Melcode'), '948150000'), 'Australian Citizen', If(equals(variables('Melcode'), '948150001'), 'NZ Citizen', 'Other'))

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Thanks Scott - that's how I got here though (why reinvent the wheel, right? 🙂 ) - the only thing I changed from my original formula was the step name to 'Get_Placement_Record'.

Thanks Mark - I'm pretty sure the numbers here are whole number values from the table, but I'll definitely give it a go!

If they are whole numbers may be you want to wrap this expression into int?

 

int(outputs('Get_Placement_Record')?['body/fc_visastatus'])

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

@Serviced2000 - Did you manage to fix the issue that you were facing?

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Hi Prasad,

 

I did, but it was down to user error. I used an expand query to get all the data into my flow but didn't quite understand how many 'hops' I needed to make to get to the data item I needed. Where I had this in my expression:

 

body/fc_visastatus

 

I should have had an extra step, like this:

 

body/contact/fc_visastatus

 

Once I added that in it worked just as it was supposed to.

 

Thanks again for all your help!

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (63,518)