Restart a numbered list in each section/table

I am a Ruby On Rails Developer and using LibreOffice (Writer) as a reporting tool. I have created a template with a section. There is a table inside this section. Further, I have created column-1 as the numbered list. This template is populated using odf_report gem and the fields are replaced with the provided values. Everything is working fine except that I want the NUMBERED LIST TO RESTART WITH 1 IN EACH ITERATION OF SECTION. Whereas currently the list is continuing from previous section.
How to achieve this?
Regards!

MORE DETAILS:
I have two tables: COMPANY & BRANCH
The Each COMPANY HAS N BRANCHES
I need a LIST OF BRANCHES COMPANY-WISE

step-1: I created a SECTION
Section Name: Company it has a field [COMPANY] to show company name like
Company:[COMPANY]
Then I have a table with 3 columns like
Company: Nestle Inc

Ser State Zip

  1.    Lahore         012
    
  2.    Karachi        999
    
  3.    Islamabad    988
    

Then for the second Country the SECTION IS ITERATED

Company: P&G In

Ser State Zip

  1.    Delhi         012
    
  2.    Mumbai        999
    
  3.    Istambul    988
    

The first column of table ser is a NUMBERED LIST whereas the other two columns have fields [STATE] , [ZIP] and are being populated from my Databas (PostGreSQL)
The problem is that in second iteration of SECTION for Country: India The
Ser for Country India shall start from 1 , whereas it is being continued from previous section to 4.

I hope, now I have explained so one can have clear understanding.

The Template is: branch.odt
The generated file is: branch.ots

Without more technical description about your template, it is impossible to answer.

Have your designed custom styles and are you using them? Note that restarting a list is a direct formatting operation. It must then be explicitly included somewhere in your template.

It looks like you are trying to generate a report from a database. Have you considered using the component Base which is an ad-hoc application for this task.

Remember answers, here, are reserved for solutions. Consequently edit your question to improve it. Mention explicitly your OS and LO version.

Have your designed custom styles and are you using them?

No, I have not designed any custom styles.

Note that restarting a list is a direct formatting operation.

True

It must then be explicitly included somewhere in your template.

How?

It looks like you are trying to generate a report from a database.

Yes! I am using POSTGRESQL at backend.

Have you considered using the component Base which is an ad-hoc application for this task.

No

Mention explicitly your OS and LO version.

Version: 6.0.7.3 Build ID: 1:6.0.7-0ubuntu0.18.04.10

(edited by ajlittoz for line breaks)

IMHO, your task will be better handled in Base where you interface directly your database. Base has a report generator module which is better fit to your task. Here, the serial number will be explicitly controlled by the report generator.

Although the skills needed are different from those for Writer and Calc, if you’re familiar with DB tables description and declaration, you should quickly adapt. The hardest part is to connect to the DB, i.e. describe the tables and activate the DB interface module (there is one for PostgreSQL). Designing a report is quite straightforward with the GUI.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

Hello,

Seem to agree with @ajlittoz in using report builder in Base. It has the ability to create ‘sections’ by setting groups. It also has accumulators which you can set up to restart numbering when groupings change.

My answer in this post (how do I add a sub total to a base report?) provides links to a Base report sample with groupings and totals and another link for accumulated values.

The LibreOffice documentation has more information on reports. See → LibreOffice Base Guide. Look at Chapter 6 - Reports