cancel
Showing results for
Did you mean:
Helper II

## Need a increment sequence flow for a given flow

I have a flow and i am pasting here . The flow is for producing a document ID, however I needed it for the form sequence with a date range of 0001 to 9999.

concat(slice(utcNow(),2,4),formatNumber(dayOfYear(utcNow()),'000'))

3 REPLIES 3
Super User

@gopichandana1

Let's assume we want to start the first 4 digit sequence at January 1, 2023.

Try this expression:

``````formatNumber(add(div(sub(ticks(utcNow()), ticks('2023-01-01T00:00:00Z')), 864000000000), 1), '0000')
``````

Explanation:

• `ticks(utcNow())` and `ticks('2023-01-01T00:00:00Z')`: Convert the current date and the fixed date to tick counts.
• `sub(..., ...)`: Subtract the tick count of the fixed date from the tick count of the current date.
• `div(..., 864000000000)`: Divide the result by 864000000000 to convert ticks to days.
• `add(..., 1)`: Add 1 to start the sequence from 0001.
• `formatNumber(..., '0000')`: Format the result as a four-digit number.

This expression should provide the sequence you wanted, incrementing by 1 each day from January 1, 2023.

(You may change January 1, 2023 to something else you want as the start date of the sequence, by changing the '2023-01-01T00:00:00Z' part to whichever date you want instead)

See if it helps @gopichandana1

Helper II

Here the first 5 belongs to document date but last 4 related to sequences or data information so i want the increment for the last 4 digits with same date.

Helper II

May i know where we can write a flow this where i have to replace

Announcements

#### Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Our team will be reviewing posts using the new "Copilot" label to ensure we highlight and amplify the most relevant and recent content, so you're assured of high-quality content every time you visit. If you share a post that gets featured in the curated gallery, you'll get a PM in the Community to let you know!The curated gallery is ready for you to experience now, so visit the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community. We can't wait to see what you "cook" up!