Book a Demo

Author Topic: Sort glossary alphabetically when generated internally from Script vs Report  (Read 4744 times)

nicholas.stanley

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
When running JScript to iterate the repository glossary, it prints the information out in the order in which it was inserted vs. how it is displayed in the glossary GUI and the particular column attribute in the GUI is selected. When the report is generated from the GUI, it is sorted alphabetically according as expected.

Does anyone know why when iterating over the repository terms, they do not do so in alphabetical order as one would presume is being stored in the model database.
We have also exited the model with everything sorted accordingly and reloaded the model...and still have this issue. Any insights would be appreciated.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Yes, because it's EA. And it's know for consistently being inconsistent.

q.

BuddyRobbins_Linquest

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
The glossary data is stored n the t_glossary table, the primary key being GlossaryID, which is an identity column.
Since there are three fields (Term, Type, Meaning) it would be presumptuous of the application assume how you want it ordered.
The api is probably using the GlossaryID (order in which you entered it), if not it'll be a crap-shoot on how your DBMS returns it-- order is not guarenteed.

If ordering is important to you and you're using jscript, just populate an array and sort it using your desired sort function.
 

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
You can populate an array and sort in jScript.
https://www.w3schools.com/js/js_array_sort.asp
Happy to help
:)