web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

for loop

(0) ShareShare
ReportReport
Posted on by 54

Is it possible to do the calculation like in normal loop.

my condition is to calculate remaining holiday

employee will enter to total holiday i had in last year and this year and i have to calculate total available holiday and when he applies leave then total available holiday should be one day minus.

 

Holiday_lastyear(HLY)

Holiday_thisyear(HTY)

Total_available_holiday(TAH) = HLY+ HTY

leave = TAH - 1

 my doubt is if i use the above formula it will work correctly when he applies first leave, after that TAH remains same and leave will be calculated from that.

 

Please help me to calculate and update the values.

For(leave = 0; leave >=TAH;leave++)

{

current_Leave = TAH -1;

TAH = Current_leave;

}

 

Categories:
  • Rahber Profile Picture
    1,935 on at
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @PapithaSekar :

    Do you want the value of TAH to be corresponding to -1 after executing "leave = TAH-1"?

    I think this does not necessarily need to be implemented through a loop.The following code can directly achieve this requirement.

     

    Ser(leave,TAH - 1);set(TAH,leave)

     

    If you insist on using loops, I suggest you use the timer control.

    I set the following Timer controls exactly according to your loop statement (if you need to adjust it, you can refer to the method I use)

    Add a timer control:

    Duration:

     

    1000/*loop in 1s(I am here just to make the presentation more clear, you can shorten the loop interval)*/

     

    OnSelect:

     

    Set(leave,0)

     

    OnTimerEnd:

     

    Set(current_Leave,TAH -1);Set(TAH,current_Leave);Set(leave,leave+1);

     

    Repeat:

     

    If(leave>=TAH,false,true)

     

    I assume ATH=10

    11.gif

    Best Regards,

    Bof

     

  • PapithaSekar Profile Picture
    54 on at

    Thank you. I will try the first formula and update you. Timer control doesn't fit in my scenario. Am creating time registration app so employee will update if they take leave during working days. Daily they will registering time. Leave registration is one part of it. 

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @PapithaSekar :

    Is your problem solved? Do you still need help?

    If you have found a solution, could you mark it as a solution so that more people can see it.

    Best Regards,

    Bof

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard