Jump to content

Text File sorting


Recommended Posts

Hi I'm trying to make a program that can sort out this text file alphabetically. The example is as follows:<BR><BR>I have a list of all my CD where they are each placed on my CD case holder. For easy finding each CD slot on the case has a number from 0 to 500. So I have made a lit of all my CD's using excell. So when I'm looking for a CD I look for the name on my list (which is sorted alphabetically) and then just check the number next to it.

My list looks something like this:

126 <Tab> Big Bear

125 <Tab> Panorama

173 <Tab> Small Bear etc....

The Above Example is alphabetically in order depending on the CD name and not on the number next to it.

I have allready made a program that automatically searches the list based on CD name and adds the new CD with the number next to it on the text file, but when I add the new Name it is not appearing alphabetically, i.e. I can put the list on the ascending order based on the number but not based on the CD name.

Any help appriciated

Thanks

Link to comment

QUOTE(Michael_Aivaliotis @ Oct 10 2007, 10:07 PM)

Try using the "sort array" function in the array palette.

I allready did that but the sort array function only works by looking at the first "character" where in my case would be a number i.e. 123 "CD Name". So it sorts it out based on the numbers that are at the beginning of each element of the array. But in my case I want to sort them based on the "CD Name" but when sorted I still want to keep the ascociated number that goes with it.

I have somehow managed to do this but I'm not too happy with the way I have done it. I'm thinking that there must be a much better way of achieving the same results.

The attached program is an example of what I'm woring on and its on two versions of LabView (8.5 and 8.2). Please ask if you need for version 8.0.

Any help appriciated.

Thanks

Link to comment

QUOTE(zero-tolerance @ Oct 11 2007, 10:25 AM)

I allready did that but the sort array function only works by looking at the first "character" where in my case would be a number i.e. 123 "CD Name". So it sorts it out based on the numbers that are at the beginning of each element of the array. But in my case I want to sort them based on the "CD Name" but when sorted I still want to keep the ascociated number that goes with it.

I have somehow managed to do this but I'm not too happy with the way I have done it. I'm thinking that there must be a much better way of achieving the same results.

The attached program is an example of what I'm woring on and its on two versions of LabView (8.5 and 8.2). Please ask if you need for version 8.0.

Any help appriciated.

Thanks

Bundle the CD Name and the number into a cluster, with the CD Name as the first element. Build an array of those clusters, one for each disc. Sort the array of clusters using Sort Array. Unbundle the cluster and write out your file.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.