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

How can I sort a list of number

Community Beginner ,
Aug 21, 2022 Aug 21, 2022

Copy link to clipboard

Copied

Hi All, 

 

I have list of 50 numbers, they are automatically generated and saved as a txt file.

 

When I place the list into InDesign is there a way to order them numerically?

 

Example - When I place the list it looks like this 

 

12870

1456

153

167

1891215

 

There are just examples 

 

but I want it ordered with the 3 digit numbers first, followed by the 4 digit and so on 

152

167

1456

12870

1891215

 

Is this possible? 

TOPICS
How to , Scripting

Views

368

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

correct answers 2 Correct answers

Community Expert , Sep 22, 2022 Sep 22, 2022

Votes

Translate

Translate
Guide , Sep 25, 2022 Sep 25, 2022

Hi all,

 

The ol'good SortParagraphs script from Adobe only performs alphabetic sort (in fact UTF16 sort) so it's a bit confusing to mark the original question as answered. A quick test shows that numbers will remain ordered like this:

 

MarcAutret_0-1664159529000.png

 

So you need to hack the script to properly handle numbers. A basic patch is to add a third option (say Numeric Sort) in the Sort Method dropdown and to link it to a numeric callback function that would—schematically—return parseFloat(a)-parseFloat(b). (Some validat

...

Votes

Translate

Translate
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

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 ,
Sep 25, 2022 Sep 25, 2022

Copy link to clipboard

Copied

LATEST

Hi all,

 

The ol'good SortParagraphs script from Adobe only performs alphabetic sort (in fact UTF16 sort) so it's a bit confusing to mark the original question as answered. A quick test shows that numbers will remain ordered like this:

 

MarcAutret_0-1664159529000.png

 

So you need to hack the script to properly handle numbers. A basic patch is to add a third option (say Numeric Sort) in the Sort Method dropdown and to link it to a numeric callback function that would—schematically—return parseFloat(a)-parseFloat(b). (Some validation steps are still required though.)

 

Or, you can use SmartSort with Sort Numbers turned on:

MarcAutret_1-1664160344363.png

 

 

Best,

Marc

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