Skip to main content
Inspiring
April 7, 2025
Answered

Reset List numbering

  • April 7, 2025
  • 3 replies
  • 1170 views

I have a 22 page document that has 6 sections. The first 3 have 3 header levels to seperate numbering. The other only have a non-numbered title and section numbers starting with 1. I can reset each first section with a simple make this number 1 numbering format. But after that the numbering goes back to follow the last section. Is there a format that will reset the numbering back to 2 for the next group? 

    Correct answer Dave Creamer of IDEAS

    Your first level Heading1 should look like this:

    R:<n+> which will result in "1". You can add a zero [R:<n+>.0] if your want "1.0".

    This will restart with each separate document (chapter). If you need it to restart at 1 in the same document, you will need a second style such as Heading1_reset [R:<n=1>].

     

    The second level would look like one of these, depending on the format:

    R:<n>.<n+> which would show 1.2 (or 2.1 if under another Heading1--it would reflect what Heading1 level it is under).

    R:< ><a+> which would show "a, b, c, etc. depending on how many Heading2's there are. 

    Either one would reset itself automatically under a new Heading1 style.

     

    The next level, Heading3, would like like one of these:

    R:<n>.<n>.<n+>

    R:< >< ><i+> which would show "i, ii, iii, etc. depending on how many Heading2's there are. 

    Either one would reset itself automatically under a new Heading2 style.

     

    And so on...

     

    As a note, the initial letter doesn't matter with the exception of the uppercase T, which Frame uses for Table Titles, although it could be changed (but I never do). You can use either upper or lowercase letters, but an uppercase R is not the same list as a lowercase r. 

     

    I hope this is clear as mud...

    I've attached a couple of files you can look at to dissect how the numbered lists are put together. 

     

    If you are still having problems, click on my name and message me. I can look at your file.

     

    3 replies

    Braniac
    April 11, 2025

    Hi Eric:

     

    We can continue to help if this is still unresolved. Or if you have it figured out, please let us know. 

     

    ~Barb

    Inspiring
    April 17, 2025

    I think I have figured out it is not easy. What I'm trying to do is reset the numbering under a numbered header. Heading 1 the sub-heading 1, 2,3 etc. So I can create a new sud-heading as R: <n=1>. That will rest my sub headings to 1. But I can't use R:<n+> to generate 2,3,4, etc. It picks up from the previous. It looks like I need to create a new L: for each, which makes the auto numbering useless execpt for the number 1. 

    New Participant
    April 17, 2025

    No, you have it wrong. Try something like this for your Headings:

    Heading 1:  L:<n+>< =0>< =0>

    Heading 2: L:< ><n+>< =0>

    Heading 3: L:< >< ><n+>

    Matt-Tech Comm Tools
    Braniac
    April 10, 2025

    (Of course, if you've already solved this, let us know and mark the correct answer)

    It sounds like you're using a combination of numbering techniques, which @Dave Creamer of IDEAS @frameexpert @Jeff_Coatsworth have all mentioned.

    You should either take up @frameexpert on his generous offer, or post the Numbering properties format of each of the tags (showing tag names and their respective numbering properties)

     

    When writing this down, there's a great chance you'll resolve the issue even before posting to us.

     

    -Matt SullivanFrameMaker Course Creator, Author, Trainer, Consultant
    frameexpert
    Braniac
    April 7, 2025

    It's hard to troubleshoot without seeing your document, but here in a recent thread about autonumbering. I provide a script that gives you an autonumber report that may help troubleshoot the issue. There are also links to a couple of videos that I posted about autonumbering.

     

    https://community.adobe.com/t5/framemaker-discussions/i-m-having-a-problem-with-chapters-starting-back-at-quot-1-quot/td-p/15231610

    frameexpert
    Braniac
    April 7, 2025

    Here is the script. Copy it to a plain text file and save it as CP-AutonumberReport.jsx. Open your document and choose File > Script > Run and select the script. It will give you a detailed report and you can post the results here.

    /* CP-AutonumberReport.jsx Version 0.2b March 28, 2025
    Copyright 2025, Carmen Publishing Inc. All rights reserved.
    
    For information, call 585-729-6746 or email rick@frameexpert.com.
    
    Not to be resold without permission.
    
    Version 0.2b March 28, 2025: Non-numbered autonumbered paragraphs are skipped. 
    Version 0.1b March 25, 2025: First release of the script. 
    */
    
    #target framemaker
    
    var CP_ANR = CP_ANR || {};
    CP_ANR.version = "Version 0.2b March 28, 2025";
    CP_ANR.file = $.fileName;
    
    CP_ANR.main = function () {
        
        var book, doc;
        
        book = app.ActiveBook;
        if (book.ObjectValid () === 1) {
            CP_ANR.processBook (book);
        }
        else {
            doc = app.ActiveDoc;
            if (doc.ObjectValid () === 1) {
                CP_ANR.processDoc (doc, 0);
            }        
        }
    };
    
    CP_ANR.processDoc = function (doc, bookId) {
    
        var pgf;
        
        // Process all paragraphs in the main flow.
        pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
        while (pgf.ObjectValid () === 1) {
            CP_ANR.processPgf (pgf, doc, bookId);
            pgf = pgf.NextPgfInFlow;
        }
    };
    
    CP_ANR.processBook = function (book) {
        
        var bookComp, doc, regex;
        
        // Regular expression for standard FrameMaker documents.
        regex = /\.fm$/i;
        
        // Loop through all of the components in the book.
        bookComp = book.FirstComponentInBook;
        while (bookComp.ObjectValid () === 1) {
            if (bookComp.ExcludeBookComponent === 0) {
                if (regex.test (bookComp.Name) === true) {
    				// Skip generated files.
    				if (bookComp.BookComponentType === Constants.FV_BK_NOT_GENERATABLE) {
    					// Get the document returned in a JavaScript object.
    					doc = CP_ANR.getDocument (bookComp.Name, undefined, false);
    					if ((doc) && (doc.ObjectValid () === 1)) {
    						book.StatusLine = "Processing " + new File (bookComp.Name).displayName;
    						// Call the function to get the document's autonumber data.
    						CP_ANR.processDoc (doc, book.id)
    						// If the document was opened by the script, save it and close it.
    						if (doc.openedByScript === true) {
    							//doc.SimpleSave (bookComp.Name, false);
    							doc.Close (true);
    						}
    					}
    				}
    			}
            }
            bookComp = bookComp.NextBookComponentInDFSOrder;
        }
    
        // Reset the book status line.
        book.StatusLine = "";
    };
    
    CP_ANR.processPgf = function (pgf, doc, bookId) {
        
        var textList, count, i, msg;
    
        if (pgf.PgfIsAutoNum === 1) {
            // Make sure there are actual building blocks (skip bullets, text-only, etc.).
            if (/</.test (pgf.AutoNumString) === true) {
                msg = pgf.PgfNumber + "  " + pgf.AutoNumString + "  [" + pgf.Name + "]";
                msg = CP_ANR.writeBookErrorLog (pgf.id, doc.id, bookId, msg);    
            }
        }
    
        // Get any tables in the paragraph.
        textList = pgf.GetText (Constants.FTI_TblAnchor);
        count = textList.length;
        for (i = 0; i < count; i += 1) {
            // Process the table.
            CP_ANR.processTbl (textList[i].obj, doc, bookId);
        }
    };
    
    CP_ANR.writeBookErrorLog = function (objId, docId, bookId, msg) { 
        
        /// msg = CP_ANR.writeBookErrorLog (objId, docId, bookId, msg);
        
        msg = 'log -b=' + bookId + ' -d=' + docId + ' -o=' + objId + ' --' + msg;
        CallClient ('BookErrorLog', msg);
        
        return msg; // Return for troubleshooting.
    };
    
    CP_ANR.processTbl = function (tbl, doc, bookId) {
        
        var pgf, cell;
        
        // If the title is at the top, process it first.
        if (tbl.TblTitlePosition === Constants.FV_TBL_TITLE_ABOVE) {
            pgf = tbl.FirstPgf;
            while (pgf.ObjectValid () === 1) {
                if (pgf.PgfIsAutoNum === 1) {
                    CP_ANR.processPgf (pgf, doc, bookId);
                }
                pgf = pgf.NextPgfInFlow;
            }
        }
    
        // Process each cell and its paragraphs.
        cell = tbl.FirstRowInTbl.FirstCellInRow;
        while (cell.ObjectValid () === 1) {
            if (cell.CellIsStraddled === 0) {
                pgf = cell.FirstPgf;
                while (pgf.ObjectValid () === 1) {
                    if (pgf.PgfIsAutoNum === 1) {
                        CP_ANR.processPgf (pgf, doc, bookId);
                    }
                    pgf = pgf.NextPgfInFlow;
                }
            }
            cell = cell.NextCellInTbl;
        }
        
        // IF the title is at the bottom, process it last.
        if (tbl.TblTitlePosition === Constants.FV_TBL_TITLE_BELOW) {
            while (pgf.ObjectValid () === 1) {
                if (pgf.PgfIsAutoNum === 1) {
                    CP_ANR.processPgf (pgf, doc, bookId);
                }
                pgf = pgf.NextPgfInFlow;
            }
        } 
    };
    
    CP_ANR.getDocument = function (filename, structuredApplication, visible) {
        
        var doc;
        
        // See if the document is already open.
        doc = CP_ANR.docIsOpen (filename);
        if ((doc) && (doc.ObjectValid () === 1)) {
            return doc;
        } 
        else {
            // The document is not already open, so open it.
            return CP_ANR.openDocOrBook (filename, structuredApplication, visible);
        }
    };
    
    CP_ANR.docIsOpen = function (filename) {
        
        var file, name, doc;
        
        // Make a File object from the file name.
        file = new File (filename);
        // Uppercase the filename for easy comparison.
        name = file.fullName.toUpperCase ();
    
        // Loop through the open documents in the session.
        doc = app.FirstOpenDoc;
        while (doc.ObjectValid () === 1) {
            // Compare the document’s name with the one we are looking for.
            if (new File (doc.Name).fullName.toUpperCase () === name) {
                // The document we are looking for is open.
                doc.openedByScript = false;
                return doc;
            }
            doc = doc.NextOpenDocInSession;
        }
    };
    
    CP_ANR.openDocOrBook = function (filename, structuredApplication, visible) {
        
        var i = 0, docOrBook = 0, openProps, returnProps;
    
        // Get default property list for opening documents.
        openProps = GetOpenDefaultParams ();
        // Get a property list to return any error messages.
        returnProps = new PropVals ();
    
        // Set specific open property values to open the document.
        i = GetPropIndex (openProps,Constants.FS_AlertUserAboutFailure);
        openProps[i].propVal.ival=false;
        i = GetPropIndex (openProps,Constants.FS_MakeVisible);
        openProps[i].propVal.ival=visible;
        i = GetPropIndex (openProps,Constants.FS_FileIsOldVersion);
        openProps[i].propVal.ival=Constants.FV_DoOK;
        i = GetPropIndex (openProps,Constants.FS_FileIsInUse);
        openProps[i].propVal.ival=Constants.FV_ResetLockAndContinue;
        i = GetPropIndex (openProps,Constants.FS_FontChangedMetric);
        openProps[i].propVal.ival=Constants.FV_DoOK;
        i = GetPropIndex (openProps,Constants.FS_FontNotFoundInCatalog);
        openProps[i].propVal.ival=Constants.FV_DoOK;
        i = GetPropIndex (openProps,Constants.FS_FontNotFoundInDoc);
        openProps[i].propVal.ival=Constants.FV_DoOK;
        i = GetPropIndex (openProps,Constants.FS_RefFileNotFound);
        openProps[i].propVal.ival=Constants.FV_AllowAllRefFilesUnFindable;
        i = GetPropIndex (openProps,Constants.FS_UseRecoverFile);
        openProps[i].propVal.ival=Constants.FV_DoNo;
        if (structuredApplication !== undefined) {
            i = GetPropIndex (openProps,Constants.FS_StructuredOpenApplication);
            openProps[i].propVal.sval=structuredApplication;
        }
    
        // Attempt to open the document.
        docOrBook = Open (filename,openProps,returnProps);
    
        if (docOrBook.ObjectValid () === 1) {
            // Add a property to the document or book, indicating that the script opened it.
            docOrBook.openedByScript = true;
        }
        else {
            // If the document can't be open, print the errors to the Console.
            PrintOpenStatus (returnProps);
            Console ("\r" + filename);
        }
    
        return docOrBook; // Return the document or book object.
    };
    
    CP_ANR.main ();
    
    Inspiring
    April 9, 2025

    Not really the issue. I have subject 1 with a list under it starting at 1. This works fine. Ihave a paragraph to reset this one to #1. On the first list I get the 2 - 5 no problem. But on subject #2, I set the #1 and it works fine, but the #2 - 5 pick up the secquence from the #1 subject and don't reset at #2 again.