Hello,
Scenario:
I want to auto populate the title field in a new "edit" form The source is a SharePoint list. I want this number to increment ever time the new submit form is navigated to.
Title number text looks like this: Job-000001
Thanks in advance.
Solved! Go to Solution.
Firstly, I'd create a Helper column in SharePoint that holds the numeric part of your Job number and set it as Type Number.
You can then get the last / highest number in your list using
Set(vLastJobNum, First(Sort(yourListName, helperColumnName, Descending)).helperColumnName)
Note: this may throw a Delegation warning but you can ignore this because you are only getting one record.
Then, on Navigation to your Form screen (or the OnVisible property) use this:
Set(vNewJobNum, Concatenate("Job-", Text(Value(vLastJobNum)+1, "00000")))
Then inside your Form on the Title datacard use the variable vNewJobNum as the Default value/property.
Depending on your App's flow ie how it functions, you may need to run both of the above formulas at the same time, it just depends really.
EDIT: I forgot to mention, you will need to update the helperColumn somehow. My suggestion would be to add the DataCard for the HelperColumn into your Form, set it's Default to Value(vLastJobNum)+1, then set it's Visibile to false. Then, when your Form is Submitted, it will update with the latest Numeric value of your Job Number.
Firstly, I'd create a Helper column in SharePoint that holds the numeric part of your Job number and set it as Type Number.
You can then get the last / highest number in your list using
Set(vLastJobNum, First(Sort(yourListName, helperColumnName, Descending)).helperColumnName)
Note: this may throw a Delegation warning but you can ignore this because you are only getting one record.
Then, on Navigation to your Form screen (or the OnVisible property) use this:
Set(vNewJobNum, Concatenate("Job-", Text(Value(vLastJobNum)+1, "00000")))
Then inside your Form on the Title datacard use the variable vNewJobNum as the Default value/property.
Depending on your App's flow ie how it functions, you may need to run both of the above formulas at the same time, it just depends really.
EDIT: I forgot to mention, you will need to update the helperColumn somehow. My suggestion would be to add the DataCard for the HelperColumn into your Form, set it's Default to Value(vLastJobNum)+1, then set it's Visibile to false. Then, when your Form is Submitted, it will update with the latest Numeric value of your Job Number.
Where am I inputting this?
Set(vLastJobNum, First(Sort(yourListName, helperColumnName, Descending)).helperColumnName)
And can you please explain about running them at the same time?
Thanks again for your help.
re: Where am I inputting this?
That depends. Say you have a Gallery where users can see options to select that take them to your Form screen, you can add this code before the Navigate() function ... or ... you can use it in the OnVisible property of your Form screen.
If you don't want to do either of these, you can just have a button/icon/label and set the OnSelect property to this code. It really depends on the flow of your app.
By 'Running at the same time' I mean join the code together. For example, if you decided to place the code before your Navigate() function (my first option above) then you would add both code blocks before the Navigate function ie 'Run them together', if that makes sense?
Just checking in to see if you managed to solve your issue? I'm happy to help further if you are still stuck, just let me know.
So It populates the field but with the value that's in the helper column. A change it a bit around:
Title number increments : JOB-900001, JOB-900002, JOB-900003...
In the helper column which is a number type I put 90000. It populates the Title field but only with the number in that field...90000.
HomeScreen button that navigates to the new form screen:
Set(vLastJobNum, First(Sort(ARSC, AutoPopHelper, Descending)).AutoPopHelper); NewForm(Form2_2);Navigate(SubmitNewScreen)
OnVisible (New form screen):
Set(vNewJobNum, Concatenate("JOB-", Text(Value(vLastJobNum)+1, "[$-en-US]90000")))
Thanks in advance.
Its only incrementing what's in the helper column not what's in the title column. So the number never changes when navigating to the new form screen.
Figured it out. Forgot to add the variable to the helper column. Works now.
Thanks for your help!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
180 | |
52 | |
41 | |
38 | |
28 |
User | Count |
---|---|
255 | |
81 | |
71 | |
68 | |
66 |