# Power Apps Sequence Function [With Various Examples]

This Power Apps tutorial will guide you on the Sequence function in Power Apps, like what is this Power Apps Sequence Function, its syntax, and how we use it.

Also, we will see various examples based on the Power Apps Sequence Function like:

1. Power Apps Sequence Numbers and Letters
2. Power Apps Sequence Dates
3. Power Apps Sequence Collection

Check out Power Apps Gallery Control Examples Download [20 Various Real Scenarios]

## Power Apps Sequence Function

• Power Apps Sequence function creates a single-column table of numbers in order, like 1, 2, and 3. The column is called Value. This might be a continuous range, like the numbers from 1 to 100, or it could be non-continuous, like [2, 4, 6, 8, 10].
• Additionally, ranges of dates and letters can be generated.
• The number of records to be produced must be between 0 and 50,000, rounded to the nearest whole number. A table that is created with no records is empty.

## Power Apps Sequence Function Syntax

The below represents the syntax of the Power Apps Sequence function:

``Sequence( Records [, Start [, Step ] ] )``

Where,

1. Records = This is required. It specifies the number of records to create. Also, it must be in the range of 0 to 50,000.
2. Start = It is optional. This defines the starting number for the sequence. The default is 1.
3. Step = It is optional. It specifies the incremental value. The step can be negative to count down from the Start. The default is 1.

## Power Apps Sequence Function Examples

Let’s work with some examples using the Power Apps Sequence Function.

### Power Apps Sequence Numbers and Letters

The table below represents all examples of Power Apps Sequence Numbers and Letters. Below are all the formulas I have used in a Power Apps Gallery Control‘s Items property.

This is all about examples of Power Apps Sequence Numbers and Letters.

### Power Apps Sequence Dates

Now we will explore how to work with Power Apps Sequence Dates using various formulas. Below are all the formulas I have used in a Power Apps Gallery Control’s Items property.

The above examples are related to Power Apps Sequence Dates.

## Power Apps Sequence Collection

This example will discuss how to work with Power Apps Sequence Collection.

• A Power Apps Button control and a Gallery control are seen in the screenshot below. The random numbers are generated in the collection, and their values are displayed in the gallery control when a user hits the “Add Random Number to Collection.”
• To achieve this, select the button control and apply the code below on its OnSelect property as:
``````OnSelect = ForAll(
Sequence(7),
Collect(
colRandomNumbers,
Rand()
)
)``````

Where,

1. 7 = Specify the total number of records that you want to generate
2. colRandomNumbers = Collection name
• Next, select the gallery and set its Items property as:
``Items = colRandomNumbers``

Refer to the image below.

• Save, Publish, and Preview the app. Click on the button; then the gallery will display all 7 random values.

This is how to work with Power Apps Sequence Collection.

## Power Apps Sequence Examples

The gallery will be generated in this example anytime a user enters any number into the text input control.

• Suppose when I entered a number as 3, the gallery automatically incremented with three sections, as shown below,
• To work around this, apply the formula below on the gallery’s Items property:
``````Items = ForAll(
Sequence(Value(txtEnterNumber.Text)),
Blank()
)``````

Where,

txtEnterNumber = Text input control name

• Save, Publish, and Preview the app. Enter a number to the text input control; the gallery will increase or decrease according to the user’s input.

This is how we can generate a gallery section automatically using the Power Apps Sequence function.

Moreover, you may like some more Power Apps tutorials: