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

Have already converted the numeric calculated columns with int() in addition but giving 0 result

Hi there,

 

I have numeric calculated columns. In a numeric column I have the following expression:

 

if(equals(triggerBody()?['Status'],'Field'), add(int(triggerBody()?['Weekends0']),int(triggerBody()?['Holidays'])),if(equals(triggerBody()?['Status'],'Office'),0,if(equals(triggerBody()?['Status'],'Stand_by'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),if(equals(triggerBody()?['Status'],'Leave'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),0)))).

 

However, the result gives 0.

 

Regards,

Deddy.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper II
Helper II

Re: Have already converted the numeric calculated columns with int() in addition but giving 0 result

Hi @v-zhos-msft ,

 

I have found the solution that ['Status'] is actually an array, so I must add an element to get the value of the user given choice. 

 

The following is the correct expression:

if(equals(triggerBody()?['Status']?['Value'],'Field'), add(int(triggerBody()?['Weekends0']),int(triggerBody()?['Holidays'])),if(equals(triggerBody()?['Status']?['Value'],'Office'),0,if(equals(triggerBody()?['Status']?['Value'],'Stand_by'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),if(equals(triggerBody()?['Status']?['Value'],'Leave'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),0))))

 

Regarding with ['Weekends0'], it is the internal name given by SharePoint. The column name is ['Weekdays']. It is strange indeed, why SharePoint has given such name, while there is also another column name ['Weekends'], and its the internal name is the same. 

 

Regards,

Deddy.

View solution in original post

2 REPLIES 2
Highlighted
Solution Sage
Solution Sage

Re: Have already converted the numeric calculated columns with int() in addition but giving 0 result

Hi @deddyandy ,

From your expression we can see, you want to return a number depend on the 'Status' value.

If 'Status'=Field, return Holidays+Weekends.

If 'Status'=Office, return 0.

If 'Status'=Stand_by, return Holidays-Weekends.

If 'Status'=Leave, return Holidays-Weekends.

Otherwise return 0.

There is a mistake of your expression:

Capture6.PNG

I have made some tests on my side:

The expression is:

if(equals(triggerBody()?['Status'],'Field'), add(int(triggerBody()?['Weekends']),int(triggerBody()?['Holidays'])),if(equals(triggerBody()?['Status'],'Office'),0,if(equals(triggerBody()?['Status'],'Stand_by'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),if(equals(triggerBody()?['Status'],'Leave'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),0))))

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Helper II
Helper II

Re: Have already converted the numeric calculated columns with int() in addition but giving 0 result

Hi @v-zhos-msft ,

 

I have found the solution that ['Status'] is actually an array, so I must add an element to get the value of the user given choice. 

 

The following is the correct expression:

if(equals(triggerBody()?['Status']?['Value'],'Field'), add(int(triggerBody()?['Weekends0']),int(triggerBody()?['Holidays'])),if(equals(triggerBody()?['Status']?['Value'],'Office'),0,if(equals(triggerBody()?['Status']?['Value'],'Stand_by'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),if(equals(triggerBody()?['Status']?['Value'],'Leave'),sub(int(triggerBody()?['Holidays']),int(triggerBody()?['Weekends'])),0))))

 

Regarding with ['Weekends0'], it is the internal name given by SharePoint. The column name is ['Weekdays']. It is strange indeed, why SharePoint has given such name, while there is also another column name ['Weekends'], and its the internal name is the same. 

 

Regards,

Deddy.

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (7,487)