ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort on substring

Greetings all. I've been beating my head against the wall on this and I think it is a "Forest for the trees" kind of thing. Anyway, I need to take a bunch of scanned in barcodes and then sort them based on the date code. The date code is the 4-digit number immediately following "FH-" I can pull the substring, make an array out of them and sort it no problem. But for the life of me I can't figure out how to then order the array of the original complete barcodes based on the datecode. Hope I am making myself clear. I attached a vi that shows the original barcodes, and how it should look after sorting. I need to be able to pull up a spec table based on the date code showing the oldest group. So, the date code in this example is 0808, 0902, 0806. I am running Labview 8.6 so nothing newer pls if an attachment is posted.

 

Appreciate any and all help/suggestions.

0 Kudos
Message 1 of 5
(3,676 Views)

hello, Franco,

 

it can be done with your personal code but jki made good tools for that

 

have a look here

 

 http://wiki.openg.org/Main_Page

 

 

Your vi modified in attachement 

 

Best regards 

 

Tinnitus

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 2 of 5
(3,668 Views)

As long as your array isn't too big, you can use a loop and create an array of cluster with your first element as your extracted 4 digit code and the second element as your full scanned string.

 

Use the Sort 1D Array function on the array of cluster, then use a for loop to extract the scanned strings (now in order).

 

Sort 1D Array Function

 

 

0 Kudos
Message 3 of 5
(3,647 Views)

Here's yet another solution. Seems the codes are fixed width, so substring with start=14, size=4 might be easier that the scan operation shown.

 

 

0 Kudos
Message 4 of 5
(3,633 Views)

Thanks for this posting! I needed a substring sort, found this, and I'm set! I'll credit you in my vi documentation.

0 Kudos
Message 5 of 5
(3,274 Views)