2 Replies Latest reply on May 20, 2011 11:15 AM by mfl666

    File Path Reference creation

    mfl666

      Title

      File Path Reference creation

      Post

      I have a Set Variable calc which creates a file path reference for storing our pics.

      Given the following calc.......

      Set Variable [ $filepath; Value:$filepathserver & "MondettaEnterprise/Groups/ERP/Documents/Programs/" & Style_Main::Style_ID_Program_SN & "_Photos/" & Style_Main::Style_ID_Serial_Number & "_" & Style_Main::Style_Count_Reference_Photos_Count & "." &
      Case (

      If ( Middle ( ( Right ( GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 5 )); 1; 1 ) ; "."; Right ( GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 5 )) ;

      If ( Middle ( ( Right ( GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 5 )); 2; 1 ) ; "."; Right ( GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 4 )) ;

      If ( Middle ( ( Right ( GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 5 )); 3; 1 ) ; "."; Right ( GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 3 )) ) ]

      Given that "Ref_Photos::RP_Photo_Path" contains

      size:529,352

      image:2110_kw_37_14.jpeg

      imagemac:/Macintosh HD/Documents/Graphics/MyPictures/Misc/2110_kw_37_14.jpeg

      Why is it that if i pick a file that is either ".jpg" , ".png" , ".PDF" I get a file path with the proper extension but if i happen to pic a file that is ".jpeg" my file path extension becomes "filename.peg".

      I have run this through debug using the first IF statement and it calculated it as ".jpeg" in the monitor but the path came out ".peg".

      Logically the first IF statement should be the one its going to choose, or am I wrong.

      I have tried removing the "." & , but then I got "filenamepeg"

      On a second note is there an easier way of extracting the file extension and creating the file path.

      Thank you

      Michael

        • 1. Re: File Path Reference creation
          philmodjunk

          I don't see how what you have inside the case function can possibly evaluate correctly, but it's much more complex than it needs to be.

          Here's a much simpler expression that will return all characters to the right of the last . in the 3rd line of "Ref_Photos::RP_Photo_Path".

          Let ( [
                    path = GetValue ( Ref_Photos::RP_Photo_Path ; 3 ) ; 
                    L = length ( path )
                  ] ;
                    Right ( path ; L - Position ( path ; "." ; L ; -1 ) )
               )

          • 2. Re: File Path Reference creation
            mfl666

            Yes it is.

            Unfortunately I've had to pick up from the other developer who created this system, he didn't use the KISS principal instead opting for the hammer option.

            There is lots of issues that I am trying to resolve in this system.

            I will put your solution to work, there are a number of other places I can use this.

            Thank you very much.

            MichaelL