Hi ,

I have the requirement to show the total leaves available - total leaves - applied leaves.

Applied leaves count is based on the number of days selected(End Date - Start Date). 

How can I implement this business case? I have start date and end sate in Leave Details Entity. 

Total leaves in Employee entity. How to proceed with this login implementation. Code snippet and process would be helpful.

Thanks,

Saicharan

Hi sai charan,

You can use the query filter, to fetch results between those dates, then group results into a single result to get a count of results.

Here you have some images to guide you: https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/Create_a_Calculated_Attribute_in_an_Aggregate

Regards,

Marco Arede wrote:

Hi sai charan,

You can use the query filter, to fetch results between those dates, then group results into a single result to get a count of results.

Here you have some images to guide you: https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/Create_a_Calculated_Attribute_in_an_Aggregate

Regards,


Hi Marco,

Thanks for the reply!!

I tried to create an expression to calculate the difference between end time and start time to get the number of days applied for leave. But could not get the functions that can be used to calculate. The requirement is when the user selects Leave start date and end date, no. of days applied for leave have to be calculated and the total available leaves must be deducted with the applied leave days count..

Regards,

Saicharan

Hi sai charan,

Inside an aggregate filters, you can calculate a difference in number of days, by using a buit-in function DiffDays.

Then you can apply this result to return your results, or continue to calculate other values to be returned.

Cheers!

Marco Arede wrote:

Hi sai charan,

Inside an aggregate filters, you can calculate a difference in number of days, by using a buit-in function DiffDays.

Then you can apply this result to return your results, or continue to calculate other values to be returned.

Cheers!

Hi,

Thank you!!

I was able to calculate the difference and get the number of days applied for leave. If the total days are 20 and in first action I have applied one leave, now available leaves are 19. Now in the second action if I apply for two leaves, now the number of leaves available has to be 17. So dynamically the count has to be reduced based on the number of leaves applied. Any thoughts how i can achieve this? I used expression - 

SyntaxEditor Code Snippet

Employee.AvailableLeaves-DiffDays(LeaveDetails.StartDate,LeaveDetails.EndDate)

But it is not working as expected. Any help please.


Thanks,

Saicharan


Hi sai charan,

You can do that using a new column, your calculated value needs to use the diff days from a separated column.