4 Replies Latest reply on Jan 21, 2015 3:50 AM by Tayyab Hussain

    .txt or CSV file to Database

    Tayyab Hussain Level 1

      Hi-

      I have a text file generated by a Pulse Oximeter, What I want is, as the system recieves the file (in .txt of CSV) it automaticly is entered into a MySql Database or SQL Server and generates an SMS message. Thanks

       

      Regards

       

      Tayyab Hussain

        • 1. Re: .txt or CSV file to Database
          Steve Sommers Level 4

          This sounds more like design requirements for an application than a question. If the question is "can CF do this type of stuff?", definitely. If the question is "is there a build in tag for doing this sort of stuff?", no. If the former is your question, I have used a custom tag from the CF community library with success -- but my experience in this area in from the CF5 days and now there are build in tags like CFSPREADSHEET that probably does the parsing you need. Once parse in a CF usable format then you can put in in any database you want.

          • 2. Re: .txt or CSV file to Database
            Tayyab Hussain Level 1

            Basiclly what I need is any Web Service or RESTful Service that can import the CVS or TXT file to any database server,(MySQL or MS SQl Server,etc), Secondly Any Idea, that how will application recognise that the database has been updated, with the new entry on runtime, (eg. if a webpage is active or say being browsed it can be refreshed,how can the Application be refreshed) If these two events are successful sending SMS is no issue. I hope I'am able to clear my point.

             

            Thanks

            • 3. Re: .txt or CSV file to Database
              BKBK Adobe Community Professional & MVP

              Web services imply using sychronous communication. However, the use case you describe implies that asynchronous, so-called fire-and-forget, communication is better suited to your needs.

               

              For example, with sychronous communication, the system is unaware of the exact moment a TXT or CSV file will come in. Also, when the system is processing a file, all other processing waits until the system finishes. This may cause synchronicity problems if multiple files come into the system in quick succession.

               

              ColdFusion has an asynchronous solution that suits every requirement of your use case. The following methods will enable you to receive the file, to automatically enter it into the database and to generate an SMS message. Use ColdFusion's DirectoryWatcher gateway to monitor the directory in which the TXT or CSV files are dropped, and ColdFusion's SMS event gateway to send SMS messages.

               

              Whenever a third party drops a file into the directory, an event is triggered, setting the DirectoryWatcher into action. Implement a query in the onAdd method of the DirectoryWatcher's listener CFC to store the file in the database.  Following the query, use the sendGatewayMessage method to send the SMS message.

              • 4. Re: .txt or CSV file to Database
                Tayyab Hussain Level 1

                Dear BKBK,

                 

                Thanks for the help, I tried what you suggested, and it worked fine. Thanks again