cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lefty
Impactful Individual
Impactful Individual

Ref number with variables

Hi all,

 

I am stuck with the following if someone could help:

I have a canvas app using SP list as its data source.

I have previously auto populated my ref number using the default ID field of a SP list, but now I need to increment the number from a choice column found in the form.

In a choice column the user has the following values:

 

TeamA

TeamB

TeamC

TeamD

 

When a user select TeamA I want the ref number to be 0001 and increment each time any user then submits a record, 
and when the user selects TeamB I want the ref number to also be 0001 and increment and so on for the remainder

 

Many months ago I learnt (Thanks PA community) the best way to increment ref numbers was using the SP ID  field and in other methods I found there was a chance of 1 record having the same ref number, maybe when 2 users were submitting at similar times.

If any one has any suggestions please let me know

Thanks

13 REPLIES 13
timl
Super User
Super User

Hi @Lefty 

Apologies for the delay in answering. I assume you HTML box is on an edit form?

If this is the case, a solution would be to set the item property of the form to the variable (eg vFormItem). In edit mode, you would set this variable to the record that you want to display on the form.

In the case where you add a new record, following the call to Patch, you would set vFormItem variable to vPatchedRecord and call Reset on your HTML box. This should configure the HTML box to show the updated record with the new serial number.

Lefty
Impactful Individual
Impactful Individual

Hi @timl 

Afraid I do not have my HTML box on a edit form - it wasnt directly linked to anything - I just needed it to gather the values so I can get Power Automate to use it for creating the PDF.

 

Would you suggestion need to be tweaked to get this to work for me?

timl
Super User
Super User

Hi @Lefty 

If your HTML box isn't on an edit form, you can still use the same technique.  That is, after the call to Patch, you would gather the values from vPatchedRecords. If you post the formula you use to set the HTML text for the HTML control, I can advise further.

Lefty
Impactful Individual
Impactful Individual

Hi @timl 

 

Thanks You have actually guided me to what I need to do, just wasn't thinking straight.

I can add the HTML control on the same screen, hide it and reference the reference number via the patched record. I need to test this but in theory I can't see why not

 

Thanks for your help on this

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,284)