Skip to main content

Numbering Subform Rows by Condition

Learn how to generate sequential numbers for subform rows based on different conditions, with each condition having its own numbering sequence.


When to Use This Feature?

When a subform contains a condition field, you may need to number rows separately based on its values.


How Does It Work?

This solution uses formulas to identify each subform row and count the preceding rows with the same condition value. Each unique value has its own numbering sequence starting from 1.


What Does It Look Like?

For example, if the condition field contains A, B, and A, the generated numbers will be A1, B1, and A2.


How to Set It Up?

Step 1 Creating the Form

Create a form with a subform named Details and add the following fields:

Field Name

Field Type

Details

Subform

Condition

Single Line(Subform)

Row No. 1

Number(Subform)

Row No. 2

Number(Subform)

Condition + No.

Single Line(Subform)

Random Code

Single Line(Subform)

Fixed-Length Value

Single Line(Subform)

Previous Values

Single Line(Subform)

Fixed-Length Value List

Single Line

Random Code List

Single Line

Count Helper

Single Line

Step 2 Configuring the Formulas

Select the corresponding field and go to Field Properties > Initial Value > Formula > Edit. Configure the following formulas in order:

Field Name

Formula

Location

Row No. 1

IF(Count Helper==1,1,VALUE(TEXT((SEARCH(Details.Random Code,Random Code List)-1)/36+1)))

Row No. 2

COUNTIF(SPLIT(Details.Previous Values,'&'),RIGHT(CONCATENATE("#######",Details.Condition),7))+1

Condition + No.

CONCATENATE(Details.Condition,Details.Row No. 2)

Random Code

UUID()

Fixed-Length Value

RIGHT(CONCATENATE("#######",Details.Condition,'&'),8)

Previous Values

LEFT(Fixed-Length Value List,(Details.Row No. 1-1)*8)

Fixed-Length Value List

CONCATENATE(Details.Fixed-Length Value)

Random Code List

CONCATENATE(Details.Random Code)

Count Helper

COUNT(Details.Condition)

Step 3 Hiding Auxiliary Fields

To keep the form clean:

  1. Select the auxiliary fields and go to Field Properties > Field Permissions. Uncheck View to hide them.

  2. Go to Form Properties > Hidden Field Default Value and select Always Recalculate.

Did this answer your question?