25 Replies Latest reply on Jan 20, 2015 7:45 AM by GEA FT 36

    Creating a Part Number Index

    GEA FT 36

      Greetings,

       

      I have made a 700  page spare parts catalog using InDesign. It includes an Index and Table of Contents based on product headings. I would like to create another index that lists part numbers and what page/pages that part number can be found on.

       

      Having made an Index before, I know how this can be done and since I have thousands of part numbers I'm not looking forward to highlighting every part number and creating an index entry. I am hoping there's an easier way like assinging an index of words/numbers that use a certain paragraph style (in my case I have a paragraph style I called "SKU" that I use for part numbers).

       

      Sample of layout for a single product. Everything is in Cell format.

       

      ItemPart NumberDescription
      11235465Part A

      2

      6843616Part B
      36846138Part C
      46846163Part D
      51681687Part E
      69865478Part F

       

       

      Thanks,

      Kyle

        • 1. Re: Creating a Part Number Index
          Peter Spier Most Valuable Participant (Moderator)

          If SKU is applied only to the part number in the table, and nothing else, you can use a Table Of Contents. You can have as many TOCs as you like, and you can sort alphabetically.

          1 person found this helpful
          • 2. Re: Creating a Part Number Index
            GEA FT 36 Level 1

            Peter,

             

            The issue I have with that is that I have several part numbers that appear on different pages. Maybe there's an easy solution to this and I hope there is because this is working well otherwise. When I create the Table of Contents it lists the same part number several times in the list one after each other (in numerical order). Keep in mind I have thousands of part numbers and hundreds of duplicates. Even though I have 5 colums of "Part Number_____Page Number" my TOC is going to be dozens of pages long due to the duplicates. Is there a way I can eliminate the duplicates and list the various page numbers that contain that part number?

             

            "123456______1, 5, 23, 100, 598"

             

            Thanks,

            Kyle

            • 3. Re: Creating a Part Number Index
              Peter Spier Most Valuable Participant (Moderator)

              Try this script (you might want to work on a copy, but really the only damage would be in the selected frame) on the frame containng the TOC of part numbers:

               

              //Consolidate lisitngs
              //By Peter kahrel with some minor additions by Peter Spier
              // Further modified to work with part number listings
              
              var myFrame = app.selection[0];     
                   if (myFrame != null && (myFrame.constructor.name == "TextFrame" ||myFrame.parent.constructor.name == "Story")) {
                   
                             app.findGrepPreferences = app.changeGrepPreferences = null;
                             app.findGrepPreferences.findWhat = "^([\\d,\\s]+)\\r\\1([\\d,\\s]+)$";
                             app.changeGrepPreferences.changeTo = "$1, $2";
                             f = myFrame.parentStory.changeGrep ();
              
                             while (f.length > 0)
                                  f = myFrame.parentStory.changeGrep ();
                                  
                   } else { alert ("Select the Index Frame");               
              }

              THis was modified from a script I use for making Index to Advertisers, and I removed some stuff, so I'm not certain it will work.

              • 4. Re: Creating a Part Number Index
                GEA FT 36 Level 1

                I don't know what any of this means or how to use it. I'm not an advanced InDesign user and I've had learn about the program on my own with the help of this forum. I was hoping there was a simple check box or something. This can't be that odd of a request.

                • 5. Re: Creating a Part Number Index
                  Peter Spier Most Valuable Participant (Moderator)

                  To use a the script you need to copy it to a PLAIN TEXT editor and save as text with a .jsx extension, then install in the program (see How to install scripts in InDesign | InDesignSecrets). It will then appear in the scripts panel and you can double-click to run it.

                   

                  If you have a list of part numbers that you can save as a text file you can also run an indexing script, such as InDexMatic (http://www.indiscripts.com/post/2011/07/indexmatic-2-public-release-and-user-s-guide) and that might even work without a list, but it's still a script, and it's not free.

                  • 6. Re: Creating a Part Number Index
                    GEA FT 36 Level 1

                    The script didn't seem to do anything when I clicked on it (even tried highlighting and clicking like the instructions said). I appreciate the help.

                    • 7. Re: Creating a Part Number Index
                      Peter Spier Most Valuable Participant (Moderator)

                      Not working here, either, which means I modified it badly, and I'm afraid I'm out of mey league on javascripting this correctly. That doesn't mean it can't be done, though.

                       

                      Peter K (who wrote the original I just mangled) or Jongware may pop in here with a correct version, or you can go over to the scripting forum and ask for soime help there.

                      • 8. Re: Creating a Part Number Index
                        [Jongware] Most Valuable Participant

                        The script didn't work because of the Find What GREP string -- it needs an additional _ character in the 'allowed' set. In addition, running it once will insert comma's and spaces in the page number list, and you need to include these as well for the second run around.

                         

                        Given the one line example

                         

                        "123456______1, 5, 23, 100, 598"

                         

                        and assuming this started out as

                         

                        "123456______1"

                        "123456______15"

                        "123456______23"

                        "123456______100"

                        "123456______598"

                         

                        this ought to work:

                         

                        //Consolidate lisitngs
                        //By Peter kahrel with some minor additions by Peter Spier
                        // Further modified to work with part number listings
                        
                        
                        var myFrame = app.selection[0];     
                             if (myFrame != null && (myFrame.constructor.name == "TextFrame" ||myFrame.parent.constructor.name == "Story")) {
                        
                                       app.findGrepPreferences = app.changeGrepPreferences = null;
                                       app.findGrepPreferences.findWhat = "^([\\d, ]+_+)([\\d, ]+)\\r\\1([\\d, ]+)$";
                                       app.changeGrepPreferences.changeTo = "$1$2, $3";
                                       f = myFrame.parentStory.changeGrep ();
                        
                        
                                       while (f.length > 0)
                                            f = myFrame.parentStory.changeGrep ();
                        
                             } else { alert ("Select the Index Frame");               
                        }
                        

                         

                        If it does not work, you need to give a couple more examples of your input lines. A single space on the wrong place can mess this stuff up!

                        • 9. Re: Creating a Part Number Index
                          GEA FT 36 Level 1

                          That also didn't work. I just outlined a quick excample of the layout. here is an exact copy/paste...

                           

                          0018-3050-820 2-12

                          0018-3050-820 2-14

                          0018-3050-820 2-14

                          0018-3149-820 3-2

                          0018-3149-820 4-62

                          0018-3620-900 4-13

                          0018-3620-900 4-13

                          0018-4376-898 2-64

                          0018-4376-898 2-64

                          0018-4376-898 2-68

                          0018-4802-828 2-12

                          0018-4944-820 2-12

                          0018-4944-820 4-23

                          0018-4944-820 4-38

                          0018-4944-820 4-82

                          0018-5575-860 4-84

                          0018-6139-820 2-5

                          0018-6276-820 4-51

                          0018-6332-820 2-12

                          0019-0258-300 2-17

                           

                          The only thing that is missing is a solid underline between the last digit of the part number and the first digit of the page number. Part numbers are laid out ****-****-*** and page numbers are *-** (section number "dash" page number). Thanks for your help.

                           

                          • 10. Re: Creating a Part Number Index
                            Peter Spier Most Valuable Participant (Moderator)

                            Are you saying that pages in the TOC are listed as a section number/hyphen/page number?

                             

                            You say the underscore is missing. How are you adding the underscore?

                            • 11. Re: Creating a Part Number Index
                              Peter Spier Most Valuable Participant (Moderator)

                              Also, it looks like part numbers are also hyphenated. Is that correct? If so do they ALWAYS follow the pattern 4digits-4digits-3digits?

                              • 12. Re: Creating a Part Number Index
                                GEA FT 36 Level 1

                                When I generated the TOC, I used a Charactor style to add the underscore between the part number and page number with the page number right-aligned. To get the page numbers to display the section number, I created a book which contains the 10 sections (each section is a different file). I used a Section Prefix in the Numbering and Sections option box.

                                 

                                The part number layout is always the same. 4-4-3.

                                • 13. Re: Creating a Part Number Index
                                  Peter Spier Most Valuable Participant (Moderator)

                                  OK, I think that's enough clarification to get the right query, but I'm going to let Jongware do the coding...

                                  • 14. Re: Creating a Part Number Index
                                    [Jongware] Most Valuable Participant

                                    Peter Spier wrote:

                                     

                                    OK, I think that's enough clarification to get the right query, but I'm going to let Jongware do the coding...

                                     

                                    Yeah well no it's not.

                                    GEA FT 36 wrote:

                                     

                                    When I generated the TOC, I used a Charactor style to add the underscore between the part number and page number with the page number right-aligned.

                                     

                                    This does not compute.

                                    • 15. Re: Creating a Part Number Index
                                      Peter Spier Most Valuable Participant (Moderator)

                                      It does if the underscore is a tab with an underline applied as a character style (which is the way I would do it).

                                      • 16. Re: Creating a Part Number Index
                                        GEA FT 36 Level 1

                                        Peter,

                                         

                                        That's exactly what I did. In the TOC builder, there is a dropdown menu to assing a character style to the space between "title" and page number. I made a style that is simply an underline and I set the page number to be right aligned. That put an underline between title and page number.

                                        • 17. Re: Creating a Part Number Index
                                          [Jongware] Most Valuable Participant

                                          Please try to be as specific as possible, otherwise the following will not work (again). There is no "space" between the title and page number, is there? Surely it's a tab?

                                           

                                          //Consolidate lisitngs
                                          //By Peter kahrel with some minor additions by Peter Spier
                                          // Further modified to work with part number listings
                                          
                                          
                                          var myFrame = app.selection[0];     
                                               if (myFrame != null && (myFrame.constructor.name == "TextFrame" ||myFrame.parent.constructor.name == "Story")) {
                                               
                                                         app.findGrepPreferences = app.changeGrepPreferences = null;
                                                         app.findGrepPreferences.findWhat = "^([-\\d]+)\\t([-\\d, ]+)\\r\\1\\t([-\\d, ]+)";
                                                         app.changeGrepPreferences.changeTo = "$1\\t$2, $3";
                                                         f = myFrame.parentStory.changeGrep ();
                                          
                                          
                                                         while (f.length > 0)
                                                              f = myFrame.parentStory.changeGrep ();
                                                              
                                               } else { alert ("Select the Index Frame");               
                                          }
                                          
                                          • 18. Re: Creating a Part Number Index
                                            GEA FT 36 Level 1

                                            Let me make sure I'm doing this correctly. I copied and pasted that into the script editor and saved it as a .jsx in the User folder. I double click on the file in scripts-User and it says "Select the Index Frame" with only OK as an option. After pressing OK, nothing happens. I highlight the entire text and double click on the file and nothing happens.

                                             

                                            There is no space and no tab between the entry and page number, only a ^y which is supposed to be the symbol for right aligned.

                                            • 19. Re: Creating a Part Number Index
                                              Peter Spier Most Valuable Participant (Moderator)

                                              Are you trying to run this from the scripts panel, or from the folder where you saved it? The error message is an alert that you didn't select the text frame before running the script, and the OK button only dismisses the warning.

                                               

                                              See How to install scripts in InDesign | InDesignSecrets for how to install the script into the scripts panel if you don't already know. To use it you should select the approrpate text frame, then double-click the name of the script in the scripts panel.

                                              • 20. Re: Creating a Part Number Index
                                                [Jongware] Most Valuable Participant

                                                GEA FT 36 wrote:

                                                There is no space and no tab between the entry and page number, only a ^y which is supposed to be the symbol for right aligned.

                                                 

                                                (sigh) First time you mention this. There are lots of ways to right align something.

                                                 

                                                Try this:

                                                 

                                                //Consolidate lisitngs
                                                //By Peter kahrel with some minor additions by Peter Spier
                                                // Further modified to work with part number listings
                                                 
                                                 
                                                var myFrame = app.selection[0];     
                                                     if (myFrame != null && (myFrame.constructor.name == "TextFrame" ||myFrame.parent.constructor.name == "Story")) {
                                                     
                                                               app.findGrepPreferences = app.changeGrepPreferences = null;
                                                               app.findGrepPreferences.findWhat = "^([-\\d]+)~y([-\\d, ]+)\\r\\1~y([-\\d, ]+)";
                                                               app.changeGrepPreferences.changeTo = "$1~y$2, $3";
                                                               f = myFrame.parentStory.changeGrep ();
                                                 
                                                 
                                                               while (f.length > 0)
                                                                    f = myFrame.parentStory.changeGrep ();
                                                                    
                                                     } else { alert ("Select the Index Frame");               
                                                }

                                                1 person found this helpful
                                                • 21. Re: Creating a Part Number Index
                                                  GEA FT 36 Level 1

                                                  This worked! Thanks! The only issue that I see is, and this is very random throughout, one of the digits on some of the page numbers are underlined where they weren't before. Just a quick scan I'd say 5% of the page numbers look like this 4-23, 3-4, 6-12, or 11-83. one had a comma underlined. It's never the first page number in the list. If it's just a fluke think I can go through and un-underline them.

                                                   

                                                  Thanks again.

                                                  • 22. Re: Creating a Part Number Index
                                                    [Jongware] Most Valuable Participant

                                                    Somewhat unpredictably, a GREP Replace refuses to accurately update text formatting -- i.e., when given a string "abc def ghi" and you replace "abc" with "a" you end up with "a def ghi".

                                                     

                                                    The script itself does not mess with underlining, and if your original part number index didn't have any underlined text, then maybe some of your hard returns were underlined -- something you'd ordinarily never noticed. To be 100% sure, check this in your original file; all you have to do is search for any underlined text.

                                                    • 23. Re: Creating a Part Number Index
                                                      beannface07

                                                      Jongware,

                                                       

                                                      I have this same issue.  I need to create an index for over 3,000 products. I created the TOC but there are alot of dupicate part numbers with different page numbers. How can I get it to look like

                                                       

                                                      370003.....................page 2, 3, 43, 53  

                                                       

                                                       

                                                      I tried using that script provided and I got an error.

                                                       

                                                      please help!

                                                       

                                                      J

                                                      • 24. Re: Creating a Part Number Index
                                                        GEA FT 36 Level 1

                                                        Hi Jongware,

                                                         

                                                        I've been using this script for a few years now with no issues, but now it's not working. Was there an update with CS5.5 that this no longer works with?

                                                         

                                                        It is giving me a JavaScript Error,

                                                         

                                                        Error number: 8

                                                        Error String: Syntax Error

                                                        Offending Text: 02

                                                         

                                                        Thanks,

                                                        Kyle

                                                        • 25. Re: Creating a Part Number Index
                                                          GEA FT 36 Level 1

                                                          Please ignore... I removed the line numbers from the text file and it worked again!