Announcement

Collapse
No announcement yet.

Mirth can't retrieve ${ORIGINALNAME} transformer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mirth can't retrieve ${ORIGINALNAME} transformer

    Hi Guys !
    Mirth can move files using this variable in the destination tab but inside a transformer or a filter ... that's impossible ... I've tested many many many possibilities but it doesn't worked.

    I've got a big problem to solve ... and i think that i'm not the only one ...

    Before posting, i've read this :
    http://www.mirthproject.org/index.php?option=com_fireboard&Itemid=97&func=view &id=698&catid=2#698
    and this (mule forum) :
    http://mule.mulesource.org/jira/browse/MULE-1197

    Is there a way to bypass this problem ?
    Does anyone got a patch to solve this ?
    :sick:
    Thanks

    Antaris

  • #2
    Re:Mirth can't retrieve ${ORIGINALNAME} transformer

    There's a way to bypass this. The available variable in the destination tab should work, and in the transformers, you will have to get "originalFileName" from the channel map.
    Jacob Brauer
    Director, Software Development
    NextGen Healthcare

    sigpic

    Comment


    • #3
      Re:Mirth can't retrieve ${ORIGINALNAME} transforme

      Thanks Jacob i'll try this method.
      Antaris

      Comment


      • #4
        Mirth is able to retrieve ${ORIGINALNAME}

        Good news today !
        Ok Jacob thanks for your help ; it works great, but the correct "orthographe" is :
        originalFilename and not originalFileName

        So in a filter or a transformer, just do it, like it :
        Code:
        channelMap.get('originalFilename');
        the others like that doesn't worked :
        $('ORIGINALNAME') => nothing.
        globalMap.get('ORIGINALNAME') => null
        connectorMap.get('ORIGINALNAME') => null
        channelMap.get('ORIGINALNAME') => null
        //_________________________________________
        $('ORIGINALFILENAME') => nothing
        globalMap.get('ORIGINALFILENAME') => null
        connectorMap.get('ORIGINALFILENAME') => null
        channelMap.get('ORIGINALFILENAME') => null
        //_________________________________________(see mule engine)
        $('ORIGINALFILE') => nothing
        globalMap.get('ORIGINALFILE') => null
        connectorMap.get('ORIGINALFILE') => null
        channelMap.get('ORIGINALFILE') => null
        //_________________________________________
        channelMap.get('originalFileName') => null


        Big Thanks Jacob !
        you're my hero ! Yatta ! :woohoo:

        Antaris

        Mirth it rocks your dev !

        Post edited by: Antaris, at: 12/18/2007 06:18

        Comment


        • #5
          Re:Mirth is able to retrieve ${ORIGINALNAME}

          I'm having a problem getting the original filename to work in my javascript step.

          var FileNameA = channelMap.get('originalFilename');

          Will this work in a javascript step or does it have to be in a channel map?

          I've tested my code by hard coding a file name and this seems to work just fine.

          Code:
            var FileNameA = '329577128.xml';
            var FileNameB = FileNameA.slice(0,(FileNameA.length-4));
            var contents = FileUtil.read('C:/Documents and Settings/Administrator/Desktop/Mirth/RTF IN/'+FileNameB+'.RTF');
          Then I switch to using the: channelMap.get('originalFilename');

          Code:
            var FileNameA = channelMap.get('originalFilename');
            var FileNameB = FileNameA.slice(0,(FileNameA.length-4));
            var contents = FileUtil.read('C:/Documents and Settings/Administrator/Desktop/Mirth/RTF IN/'+FileNameB+'.RTF');
          and I get the following error showing that the variable ends up being equal to nothing:

          Wrapped java.io.FileNotFoundException: C:\Documents and Settings\Administrator\Desktop\Mirth\RTF IN\.RTF (The system cannot find the file specified)


          Any ideas what I am doing wrong?

          Post edited by: JasonGriffith, at: 07/01/2008 09:02

          Comment


          • #6
            Re:Mirth is able to retrieve ${ORIGINALNAME}

            You have been bitten by the dreaded spaces in "Documents and Settings" ... try a path without any spaces...

            Comment


            • #7
              Re:Mirth is able to retrieve ${ORIGINALNAME}

              I dont think that is it. In my explaination above, the code works with a hard coded file name.

              The error shows that there is no file name

              C:/documents and Settings/Administrator/Desktop/Mirth/RTF IN/.RTF

              when it should be something like

              C:/documents and Settings/Administrator/Desktop/Mirth/RTF IN/329577128.RTF

              any other ideas?

              Comment


              • #8
                Re:Mirth is able to retrieve ${ORIGINALNAME}

                try... var FileNameA = channelMap.get("originalFilename");

                instead of single quotes, var FileNameA = channelMap.get('originalFilename');

                bad form on the previous post, jumped the reply before reading it thoroughly...

                Comment


                • #9
                  Re:Mirth is able to retrieve ${ORIGINALNAME}

                  Ok, I tried:

                  Code:
                  var FileNameA = channelMap.get("originalFilename"«»);
                  But I still get the same error message:

                  Wrapped java.io.FileNotFoundException:
                  C:/Documents and Settings/Administrator/Desktop/Mirth/RTF IN/.RTF
                  (The system cannot find the file specified)

                  Comment


                  • #10
                    Re:Mirth is able to retrieve ${ORIGINALNAME}

                    Does anyone have a channel that they can post, where they have this working?

                    Comment


                    • #11
                      Re:Mirth is able to retrieve ${ORIGINALNAME}

                      I figured out the problem that I was having. The channelMap.get('originalFilename'); wasnt the problem that I was having. It was the '.slice' that I was trying to use afterwards.


                      My original code was:

                      Code:
                      var FileNameA = channelMap.get('originalFilename');
                      var FileNameB = FileNameA.slice(0,(FileNameA.length-4));
                      var contents = FileUtil.read('C:/Documents and Settings/Administrator/Desktop/Mirth/RTF IN/'+FileNameB+'.RTF');

                      The working code is:

                      Code:
                      var FileNameA = channelMap.get('originalFilename');
                      var FileNameB = FileNameA.substring(0,FileNameA.length()-4);
                      var contents = FileUtil.read('C:/Documents and Settings/Administrator/Desktop/Mirth/RTF IN/'+FileNameB+'.RTF');

                      I replaced .slice with .substring in the second line.

                      Comment


                      • #12
                        Re:Mirth is able to retrieve ${ORIGINALNAME}

                        Thanks for posting your solution Jason.
                        Jon Bartels

                        Zen is hiring!!!!
                        http://consultzen.com/careers/
                        Talented healthcare IT professionals wanted. Engineers to sales to management.
                        Good benefits, great working environment, genuinely interesting work.

                        Comment


                        • #13
                          Thanks Antaris! Your 'exactness' on the syntax solved my issue!!

                          Comment

                          Working...
                          X