cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
deddyandy
Level: Powered On

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
deddyandy
Level: Powered On

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
v-zhos-msft
Level 10

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.

deddyandy
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 277 members 4,703 guests
Please welcome our newest community members: