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 Platform Community / Forums / Power Apps / Running a loop in powe...
Power Apps
Unanswered

Running a loop in powerapps based on user input and save each record in db

(0) ShareShare
ReportReport
Posted on by 15

Hi guys,

I am new to PowerApps and am struggling with a looping problem. I have a slider n user will select value on slider . According to selected value the  loop should be run and everytime record should be store in db – excel table. Data stored should be app name , id and vmname.

 Currently id has property that it will autoincrement with default property set to If(EditForm1.Mode = FormMode.New,Last(Table1).Id + 0001,Parent.Default)

And vmname has concatenate function Concatenate("test-",Text(DataCardValue5),Text(Label1))

 so I am looking to implement a case if user selects value 2 on slider  then following data should be saved to excel table

  1. App name   Id     vm name
  2. App1         0001  test-App10001
  3. App2         0002   test-App20002

 

Any assistance is greatly appreciated. And if you need any further information, I will happily provide.

 

Thanks

 

Categories:
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @AzureLearner 

     

    Can you please confirm the need of Edit Form here in this case? If you are dealing with individual controls, you can either create a button to create rows or can do it directly when the slider value is changed.
     
    Expression that can be used:
     
    ForAll(FirstN([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],Slider1.Value),Patch(Table1,Defaults(Table1),{AppName:Concatenate(TextInput1.Text,Text(Value)),Id:Text(Value(Last(Table1).Id)+1,"[$-en-US]0000"),'VM Name':Concatenate("test-",TextInput1.Text,Text(Value),Text(Value(Last(Table1).Id)+1,"[$-en-US]0000"))}))
     
    Here, Slider1 is the name of Slider control and Table is the name of name of Excel table.MicrosoftTeams-image (18).png

     

    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • AzureLearner Profile Picture
    15 on at

    Yes, I am having a form structure. This is part of my edit screen. PFA .

    PowerAppTree.PNG
    PowerAppLoop.PNG
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @AzureLearner 

     

    Looking at the screenshots, I am not clear on the fact why do you want to apply a loop on the Edit Form. Edit Form deals with a single item in the data source. This cannot be achieved with an edit form. Instead you can create independent controls and use Patch to create the records in data source. For that, you use the formula I provided in my previous comment. 
     
    Please share more information about the logical implementations so that we can help you better.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • AzureLearner Profile Picture
    15 on at

     

    @yashag2255 

     

    I have three screens.Basic motto of application is to create unique names by appending app name + number-id.
    1)On edit screen I have provided radio button of one n multiple.

    If user selects one then user can add app name , id auto populated (autoincremented by 1) and vmname is generated with concatenation.

    2)I am looking to create multiple vmnames similarly.
    if user selects mutiple - radio button , slider will be visible.
    if user selects value 2 on slider,
    at first I will be entering app name: testapp1 Id: last +1 :e.g 6 ->vmname testapp10006

    this should be saved in excel table.

    Next I will be entering  app name: myapp1 Id: last +1 :e.g 7 ->vmname myapp10007

    This also should be saved. 

     

    Let me know if any more info I need to share.Thank you!

    PowerAppTree.PNG
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @AzureLearner 

     

    When you are selecting multiple radio button, do you wish to enter the values everytime or this will get autogenerated when the user input is added for the first item? Also, If you are looking for entering all the values, will this be done on a single click or the user is supposed to click everytime the form is entered with some value?

    If you wish to create VM name based on App Name entered and the ID, you can use the concatenation formula as:
     
    Concatenate(DataCardValue1.Text,Text(Value(DataCardValue2.Text),"0000"))
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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