Get the filename on IBDir Parse and pass to OB filename

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Get the filename on IBDir Parse and pass to OB filename

  • Creator
    Topic
  • #50328
    Jerry Tilsley
    Participant

    Currently looking for a way to capture the inbound filename and pass it as the outbound filename.  I have searched the forums and so far the best way i found (from old posts) was to build a global list.  Just wanted to see if there was better ways out there that someone might be using.

    Thanks!

Viewing 10 reply threads
  • Author
    Replies
    • #65649

      The easiest way I’ve found to do this is by echoing the file name to the file itself using exec echo … .  😆

      -- Max Drown (Infor)

    • #65650

      Here’s an example …

      Code:

             run {
                 # ‘run’ mode always has a MSGID; fetch and process it
                 keylget args MSGID mh

                 set fileList [msgget $mh]
                 set obdir $HciSiteDir/iig/files/$HciConnName

                 foreach pdfFile $fileList {

                     # Convert the PDF document to a text document
                     puts “[whereAmI] Converting $pdfFile to text …”
                     if {[catch {exec /usr/local/bin/pdftotext -layout $ibdir/$pdfFile $ibdir/${pdfFile}.dat} catch_return]} {
                         puts “[whereAmI] Error: $catch_return”
                     }

                     exec echo “nnFileName: $ibdir/$pdfFile” >> $ibdir/${pdfFile}.dat

                     lappend newMsg “${pdfFile}.dat”

                 }

                 # Have Cloverleaf read in the content of the .dat file instead of the .pdf file.
                 msgset $mh $newMsg

                 lappend dispList “CONTINUE $mh”
             }

      -- Max Drown (Infor)

    • #65651
      Jerry Tilsley
      Participant

      Not sure this will work.  The file we are trying to send contains many HL7 messages.  We need to send these files to the receiving system as a single file with a pre-determined filename.  If using your example, how would I use the .dat file in conjuction with the file I’m trying to send?

    • #65652

      How are you receiving the files into Cloverleaf? Are you using a tpc ScanDir proc?

      -- Max Drown (Infor)

    • #65653
      Jerry Tilsley
      Participant

      I have a couple threads that dump messages into specific files/directories.  Then I have a inbound thread that picks up these grouped messages and it (if I get this working) sends them to an outbound thread that FTP’s the single files to our Vendor.  

      We do this because we can only send 1 file of each type of messages (1 ADT and 1 Results) each day and once the file has been sent we cannot modify the files.  The inbound thread that is sending to the ftp outbound thread is setup to pick up any files that have a date in them earlier than today (ex. adt20080928.dat, results20080928.dat).  So the goal is for the inbound thread to pick a file like adt20080928.dat and send it, with the obfile set to this same name to the outbound thread that will ftp to the vendor.

    • #65654
      Lingmei Pan
      Participant

      This is what I do:

      Code:



       # ‘run’ mode always has a MSGID; fetch and process it
       keylget args MSGID mh;

       set msg [msgget $mh];

       #set the output file name = OriginalFileName.hc
       set extension “hc”;

       #parse inbound filename from DRIVERCTL
       set driverCTL [msgmetaget $mh DRIVERCTL];
       set ibFilePath [keylget driverCTL FILENAME];

       set index [string first “/” $ibFilePath];
       set ibFileName [string range $ibFilePath [expr $index+1] end];

       set index [string first “.” $ibFileName];
       set obFileName [string range $ibFileName 0 [expr $index-1]];
       set obFileName $obFileName.$extension;

       set driverControlString “{FILESET {{OBFILE $obFileName}}}”;
       msgmetaset $mh DRIVERCTL $driverControlString;
       
       lappend dispList “CONTINUE $mh”;

    • #65655
      Robert Kersemakers
      Participant

      Hi all,

      I am using the proc ‘gc_getIBFilesetNameForOB’ to get the inbound filename and use that filename for the outbound file. This proc should be placed in ‘TPS Directory Parse’ AND ‘TPS Inbound Data’. Works like a charm!!

      @Jerry: I think you already have a proc in the ‘TPS Directory Parse’, in order to only pick up specific files. I guess you will need to put gc_getIBFilesetNameForOB after your own proc then. Just give it a try.

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

    • #65656
      Dinakar Desai
      Participant

      You can set the file name in USERDATA (meta data) or DRIVERCTRL  in the inbound thread (one that picks up the file) and let the sending (outbound) thread get the filename from USERDATA/DRIVERCTRL and set as file name in ftp.

      I have many threads that ftp this way. I do not use Cloverleaf FTP, I have written a proc for this using ftp package.

    • #65657
      Jerry Tilsley
      Participant

      I appreciate everyone’s responses.  I now have this working the way I had expected.  Thanks!

    • #65658
      Brian Sweetland
      Participant

      Jerry/All,

      How did you get this to work?

      I have thread_a that scans a local folder for PDF files. It then

    • #65659

      in 5.6 and beyond, you can pull the file name from the message meta data.

      -- Max Drown (Infor)

Viewing 10 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
4,966
Forums
28
Topics
9,104
Replies
33,617
Topic Tags
248