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

While, loop or cycle. Convert code c# to work in my app

I need to translate this code that I have created in C # so that it can work in my powerapps application. What it does is a while increasing 0.01 to the amount entered
Code:
Float pr = quantity;
Decimal See = decimal.Parse (quantity.ToString ());
If (pr % float.Parse (lblCoefArt.Text)! = 0)
         {
             While (enter == true)
             {
                 See = See + 0.01m;
                 If (See% decimal.Parse (lblCoefArt.Text) == 0)
                 {
                     String fun = "MUST BE:" + See
                 }
             }
         }

LblCoefArt.Text = Coefficient of my database
Quantity = Quantity entered by the user

Fun = Shows the quantity that the user has to enter

4 REPLIES 4
Community Support Team
Community Support Team

Re: While, loop or cycle. Convert code c# to work in my app

Hi @jdelacrettaz,

 

I'm investigating on this question and will update you once I got any update later.

 

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jdelacrettaz
Level: Powered On

Re: While, loop or cycle. Convert code c# to work in my app

I hope you find a solution. Thank you so much for help me
Community Support Team
Community Support Team

Re: While, loop or cycle. Convert code c# to work in my app

Hi @jdelacrettaz,

 

Currently there is no loop function (like the While, or do until) available in PowerApps.

If you would like PowerApps to add this function, then please consider submit this as an idea in the following forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

There is if function available under PowerApps, but the logic is the following:

If( Condition, Result [, ElseResult ] )
If( Condition1, Result1 [, Condition2, Result2, ... [ , ElseResult ] ] )

Once the condition is met, it will then show the result, which as a result, only calculate once.

 

For example:

If(Test1=0,UpdateContext({Test1:Value(TextInput1.Text)}),UpdateContext({Test1:Test1+1}))

Using the above formula in a button, would only make Variable Test1 + 1 for each time the button is pressed.

 

Adding the formula reference:

Formula reference for PowerApps

Understand variables in PowerApps

 

Edited,

There is a forall function, which would work for each row of the table, check to see if that would help in your scenario:
https://powerapps.microsoft.com/en-us/tutorials/function-forall/

If you have any further questions, please let me know.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
mr-dang
Level 10

Re: While, loop or cycle. Convert code c# to work in my app

The Timer control can loop operations. 

 

Change the Duration for how often you want the action to occur in milleseconds. 

Change the Start and Repeat properties to a condition for when you want the loop active.

Change the OnTimerEnd property to perform the action you want.

 

Microsoft Employee
@8bitclassroom