7 Replies Latest reply on Mar 8, 2009 9:00 PM by Husky

    Help with a custom Sort for electronic parts

    Husky

      Title

      Help with a custom Sort for electronic parts

      Post

      I need to build labels that get sorted since this is for electronic parts where 3 or 4 parts are in 1 bin

      The problem is there are designators for multipliers

       

      For instance on resistors 470 is written as 470r,  4700 is 4K7, 4,700,000 is 4M7

      I need a sort that would sort these in this order 470r, 4K7, 4M7 

       

      Other parts

      .0001 is 100p, .001 is 1n, .01 is 10n, .1 is 100n, 1 is 1u 10 is 10u

      I need these sorted as 100p, 1n, 10n, 100n, 1u, 10u

       

      Anyone have any ideas without entering both since there are thousands of parts

      Thanks 

       

       

        • 1. Re: Help with a custom Sort for electronic parts
          comment_1
            

          You'll need a add a calculation field that translates the codes into their numeric values, and use that for your sorts. For example,

           

          Let ( [
          factor = Case (
          PatternCount ( Code ; "K" ) ; 10^2 ;
          PatternCount ( Code ; "M" ) ; 10^5 ;
          PatternCount ( Code ; "n" ) ; 10^-3 ;
          PatternCount ( Code ; "p" ) ; 10^-6 ;
          1
          )
          ] ;
          Code * factor
          )

           

          works for all your examples - though I am not sure if these are exhaustive. If there can be a code "4K25" meaning 4,250, then a more complex approach might be required.





          • 2. Re: Help with a custom Sort for electronic parts
            raybaudi
              

            Hi Husky

             

            You'll need to sort another calculated field with a calc like this:

             

            Case(
            PatternCount ( Part ; "R" ) ; GetAsNumber ( Part );
            PatternCount ( Part ; "K" ) ; GetAsNumber ( Part ) * 10 ^ 2;
            PatternCount ( Part ; "M" ) ; GetAsNumber ( Part ) * 10 ^ 5;
            PatternCount ( Part ; "P" ) ; GetAsNumber ( Part )  /  10 ^ 6 ;
            PatternCount ( Part ; "N" ) ; GetAsNumber ( Part )  /  10 ^ 3 ;
            PatternCount ( Part ; "U" ) ; GetAsNumber ( Part ) 
            )

             

            Edit: I was too late ;)




            • 3. Re: Help with a custom Sort for electronic parts
              comment_1
                

              I think I've  figured it out: the characters are multipliers (p=pico, n=nano, u=micro, K=kilo, M=mega, etc.), and the position of the character is where the decimal point should be. But the examples are wrong: 10u is actually 0.00001, not 10.

               

              Here's a general formula:

               

              Let ( [
              char = Filter ( Code ; "pnumKMGT" ) ;
              num = Replace ( Code ;  Position ( Code ; char ; 1 ; 1 ) ; 1 ; "." ) ;
              pos = Position (  Substitute ( "pnum KMGT" ; char ;  "§" ) ; "§" ; 1 ; 1 ) ;
              e = Case ( pos ; pos - 5 ) * 3
              ] ;
              num * 10^e
              )



              • 4. Re: Help with a custom Sort for electronic parts
                Husky
                  

                Yes the letter is the multiplier and used as the decimal place, it is much easier to read schematics this way.

                Everything is usually written micro farad, nobody uses farads so in as much as 10uf is .00001 farads, nobody uses farads, the largest value is in microfarads

                 

                So 10uf is larger than 1uf

                .00001 would be 10pf.... pf is 6 decimals over from uf which is normal notation

                .0001 would be 100pf

                .001 (uf) would be 1000pf or in EU it is 1n

                For capacitors common use is uf, nano, pico

                 

                Resistors it is r for ohms, K for kilo and M for meg

                I will try  this

                Thanks

                guys!

                 

                • 5. Re: Help with a custom Sort for electronic parts
                  Husky
                     Well yes depending on the tolerance of the part we could easily have a 4K68 which would be 4.68K or 4,680 ohms
                  • 6. Re: Help with a custom Sort for electronic parts
                    comment_1
                      

                    Husky wrote:

                    nobody uses farads


                    Except your notation. By the logic of the code 10u means 10*10^-6 and the unit is farad. It doesn't really matter, because it will sort correctly either way - but the calculation can be a lot simpler when all part types are treated the same way.


                    • 7. Re: Help with a custom Sort for electronic parts
                      Husky
                        

                       

                       


                      Can you hold my hand a bit on how to enter this below ? I dont understand the S character (I'm a newbie)

                      My part field is "Value" I'll call my sort field "Calc"

                       

                      Here's a general formula:

                       

                      Let ( [
                      char = Filter ( Code ; "pnumKMGT" ) ;
                      num = Replace ( Code ;  Position ( Code ; char ; 1 ; 1 ) ; 1 ; "." ) ;
                      pos = Position (  Substitute ( "pnum KMGT" ; char ;  "§" ) ; "§" ; 1 ; 1 ) ;
                      e = Case ( pos ; pos - 5 ) * 3
                      ] ;
                      num * 10^e
                      )