Hi PowerAddicts,
This video is all about how to implement looping in PowerApps.
In this video, I have covered 3 different ways of implementing loops in PowerApps:
You can download the app from https://github.com/krishnaVSU2020/PowerAppsLooping/blob/master/Definite%20And%20Indefinite%20Lopping...
Import the App using the "Import canvas App" option available in the Apps left navigation menu of https://make.powerapps.com/
Thank You,
Krishna Vandanapu
PowerApps SuperUser
watch?v=mmeDv6b1Zhg
Hi KrishnaV,
In the third example, you could use "Mod(varItrCount,2)=1" as the Default of the tglLoop. (Odd is true and Even is false) Then you don't have to use the separate Variable "varLoop" anymore.
And in the OnChange you don't have to Select the Button, you can handle everything inside the OnChange.
If(
varItrCount > 0 && varItrCount <= Value(txtItrCnt.Text),
// Collect and increment Counter
Collect(
collTable,
{tblRowVal: txtTblNum.Text & " X " & varItrCount & " = " & varItrCount * Value(txtTblNum.Text)}
);
UpdateContext({varItrCount: varItrCount + 1}),
// Else : Reset Counter
UpdateContext({varItrCount: 0})
)
The code in the Button could then just be
Clear(collTable);
UpdateContext({varItrCount:1})
Regards,
Gabrz