Skip to main content
Inspiring
February 24, 2022
Question

displaying Leading Zeros for file count in a book? without hacking?

  • February 24, 2022
  • 3 replies
  • 644 views

I asked this a couple of years back and was curious as to know if this can (will) be added to potential future versions of FrameMaker?

ex: 1-001 to 1-025, 2-001 to 2-370, 3-001 to 3-500, 4-001... etc.

[where the first value is the section (or chapter) and the 3 remaining digits represent a counter of files in that section] 

    This topic has been closed for replies.

    3 replies

    Matt-Tech Comm Tools
    Community Expert
    Community Expert
    February 25, 2022

    That format is often used in ATA (airlines) and MIL-SPEC (govt/military) docs.

    Are you trying to develop support for something like this?

    Structured solutions are available commercially for many of those standards. 

    -Matt

    -Matt Sullivan, FrameMaker Course Creator, Author, Trainer, Consultant
    Inspiring
    February 25, 2022

    Matt, very perceptive! I would love some insight on those options!

    Matt-Tech Comm Tools
    Community Expert
    Community Expert
    February 25, 2022

    A few of us here have worked with clients with similar needs, so we tend to recognize a pattern!

     

    The requirements go quite a bit past the leading zero requirement in the pageblock, and thus not many internal departments can develop the needed components on their own.


    What standard(s) do you need to support?

     

    -Matt

    -Matt Sullivan, FrameMaker Course Creator, Author, Trainer, Consultant
    K.Daube
    Community Expert
    Community Expert
    February 25, 2022

    You may have a look into my website https://www.daube.ch/docu/fmaker88.html. In the FMjsxLib there is a function FormatValue with this snippet:

     

     

     

       case "J":
          if (value > 0) {
            value = (Math.floor (value));
          } else {
            value = (Math.ceil (value));
          }
          sResult = KLD_Z.PadWith0(value, fmtSize);
          return sResult;

     

     

     

    The function PadWith0 is this

     

     

     

    KLD_F.PadWith0 = function (number, nPlaces) { // ================================
    /*            Pad figures with leading zeroes
    Arguments     number: any positive number
                  nPlaces: resulting length after padding
    Returns       Function value =  string: padded number: 7,2 => 07; 1234,3 => 1234
    Comment       If nPlaces is insufficient, the last figure will become a ?
                  Negative numbers are rejected as NaN.
    Called by     FormatValue, GetTmpVarName
    History       < 2019
    */
    var j, jMax, sResult;
    
      if (number < 0) {return NaN;}
      sResult = number;
      if (typeof number == "number") {
        sResult = String(number);
      }
      jMax = nPlaces - sResult.length;
      if (jMax < 0 ) {
        sResult = sResult.substr (0, nPlaces - 1) + "?";
      } else {
        for (j = 0; j < jMax; j++) {
          sResult = '0' + sResult;
        }
      }
      return sResult;
    } //--- end PadWith0 -----------------------------------------------------------------

     

     

     

    frameexpert
    Community Expert
    Community Expert
    February 25, 2022

    It still requires hacking. You can go to https://tracker.adobe.com and put in a feature request. If you want a scripting solution, please contact me offlist.