• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sorting Index by first n-digits

Participant ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

An index with 20k codes has to be sorted differently, considering only the first n (7 in my cae) digits.

Codes has variable number of digits (from 7 to 12 or more). I just need to order them ignoring anything above the 7th digit.

Thanks for help

TOPICS
How to

Views

362

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

This may be achievable with a script, but in my experience, very specialized tasks like this are better done by tools outside InDesign. Without knowing anything further, I'd use something like Excel to sort the list; just possibly Word.

 


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

Sorting is a built in script but it's quite basic as it lacks a function window wherr one could specify a filter to apply before sorting. Does anybody know about a better script? Going outside Indesign is a bad idea as many styles and objects applied would go... fishing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

ID scripts can be made quite complex and could probably handle it (I am a fledgling script guy at best, so I'm not the one to help with it.) My only concern is that 20,000 items is a lot, at least for InDesign... many of its capabilities have either modest data spans or slow way down past certain limits. Not sure if this one of those or not.

 

Some of the scripting gurus should check in soon on this. If not, I'll bump it to get their attention.

 


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

Hi,

 

Just a simplistic Script that includes in each entry a "sort by" as: the 7 first digits!

 

Best,

(^/)  The Jedi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

… Well! Something like this:

 

index with basically sorted (ID by default) entries:

 

Capture d’écran 2023-03-29 à 22.00.53.png

 

What the op seems to want:

 

Capture d’écran 2023-03-29 à 22.02.55.png

 

As you can see, the numbers are sorted basing on the first seven digits!

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

Thank you although I can't figure out how it works. You use only the  expression and there's no need to specify how many digits do you need? Well in my case the summary has produced a column with all the 20k lines as in the example hereunder:

unsorted.png

In the meanwhile I tested SmartSort (https://indiscripts.com/category/projects/SmartSort)

It's a freeware and works much faster than the bundled Indesign's sorting javascript.

Although it has some customization options for the text, there's almost none when dealing with numbers.

The script's result (applied after objects cleansing) seems quite correct even without specifying the desired "n" value.

I have to test it deeper to see it's behaviour whith the tiny "new" object between the code and the page number.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

Test completed, problem solved. The freeware script made the job. It's a pitty I still don't understend how in the detail, but the result is achieved.

Here's the screenshot of the result with the "New" object in it's place (it would have been a pain in the back to preserve it through an Excel sheet).

I.e. 061902202...  is now in the correct position.

Thanks to "Indiscripts" and to the people who replied to my question. By the way I'd like to discover how to use (^/) and assign it's function to the first n-digits only.

smartsorted.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

LATEST

Glad you've done it 🙂 

 

This "New" icon wouldn't be a problem with the Excel way 😉 as long as it's the only icon 😉 

 

You can search for Anchored Objects in the text:

 

Anchored Object Marker

Text - ^a

GREP - ~a

Unicode - U+FFFC

 

So you could change it to some text representation - "icon" , then after sorting - replace back with the same icon - copy icon to clipboard, then find "icon" text and replace with "^c". 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2023 Mar 29, 2023

Copy link to clipboard

Copied

What do you mean by Index? 

 

If a list of codes - single code per line - the quickest way would be to copy to Excel, sort and paste back. 

 

If there is more info associated with the code - it will be more complicated - but of course perfectly doable 😉 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines