here is how this can be achieved using AutoIndex Job.
Make sure you know name of your File Cabinet database table (here we use fctable) and your Filecabinet has a numeric field to accept docuement total pages(doctotalpages)
Create an AIX job - I recommend scheduled job with selection criteria 'doctotalpages is empty'
On Match Data Tab - Configure Data Source, select connection GUID_autoindex, SQL Command, type in the following statement
select docid,sum(totalpages) as doctotalpages from fctable_sec group by docid
Match FIlefd : Doc ID is equal docid
Assign Data: doctotalpages - Field - doctotalpages
Run the job - it should fill you doctotalpages column with total number of pages for the document.