Hi @prathig14 ,
Could you please share a bit more about your scenario?
Do you want to generate a dynamic form and dynamic controls via pressing a button?
If you want to generate a dynamic form and dynamic controls via pressing a button, I afraid that there is no way to achieve your needs in PowerApps currently.
If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
Currently, within PowerApps, the form and controls within this form are based on the data source the form connects to. There is no way to generate a dynamic form and dynamic controls within it.
As an alternative solution, you could consider display/hide the specific form based on specific condition (Conditional Visibility), you could also display/hide specific controls within a form based on a specific condition.
On your side, you could add multiple Edit forms (or Display forms) within your app screen. Then set the Visible property of the Edit form to following:
If( /* for Edit form1 */
"Condition1",
true,
false
)
If( /* for Edit form2 */
"Condition2",
true,
false
)
If( /* for Edit form3 */
"Condition3",
true,
false
)
...
In addition, within your Edit form (or Display form), you could also display/hide controls based on specific condition. E.G. Within the Edit form1, set the Visible property of the DataCard1 to following:
If(
"SpecCondition1",
true,
false
)
set the Visible property of the DataCard2 to following:
If(
"SpecCondition2",
true,
false
)
...
On your side, you could change the above condition status via pressing the "Button" controls in your app (e.g. add formula within the OnSelect proeprty of the button to change the condition variable), then corresponding forms or controls would be displayed
Please check and see if the following videos would help in your scenario:
https://www.youtube.com/watch?v=yCXT3PyOp4A
https://www.youtube.com/watch?v=IvapIsBbM-U
Best regards,