TIBCO Tutorial: Create CSV File In TIBCO Designer BW Process

By | March 4, 2014

In this TIBCO step by step tutorial, I will explain how you can create a CSV file in TIBCO BW process using designer which you can later read and modify using Excel. CSV file will be created based on the records fetched from a database table.

Step 1: Create a TIBCO Process with JDBC Query Activity:

Create a process in TIBCO designer. I created a process with the name CreateCSVFile. In the process, add a JDBC query activity. This activity will fetch data from Oracle database table TBL_EMPLOYEE using following query:

Select * from tbl_employee

This table has following data already inserted by me:

database table entries

 

 

I assume that you have already created a database connection in your TIBCO BW Project which you will reference in this activity.

JDBC Query activity configuration will look like below:

tibco jdbc query to get all records

When you click on Fetch button and then go to output tab of JDBC Query, it should look like below:

jdbc query output

Step 2: Add Write File Activity in TIBCO BW Process:

For creating csv file, add Write File activity in the process. Configuration of Write File activity will be as shown below:

create csv file configuration

Since we want to loop through the records fetched from database and write them in comma separated from in a csv file, we need to put this Write File activity in a group. Create a group on this activity as shown below:

iterate group configuration

In the input tab of Write File activity configuration, I have specified the name of the file (Employee.csv).

Employee.csv file is already created by me in the given location with only header information pre-populated as shown below:

csv data header

Input for this file is also specified in textContent mapping in input tab which is comma separated information fetched from database.  XPath for textconent is given below:

concat($EmployeeInfo/Record/EMP_CODE,”,”,$EmployeeInfo/Record/EMP_NAME,”,”,$EmployeeInfo/Record/EMP_DESIGNATION,”,”,$EmployeeInfo/Record/EMP_AGE,”&crlf;”)

Please note that I have used carriage line return in this XPath so that every record is written in a new line in the csv file.

Input tab of create csv file will now look like below:

create csv file input mapping

Step 3: Test the Process and Verify CSV file:

Now we are done with all necessary configurations of activities used in our TIBCO designer process. Validate the project to make sure that all is fine. Once validated successfully, we can move towards testing of the process.

In designer tester, load the process and start it. As you can see below, it has run successfully.

create csv tester

Now we need to go to the location where our csv file has been written and verify its contents. As you can see in below screenshot, information fetched from Oracle database table has been written in csv file in proper format:

csv output data

You can now open this csv file using Excel and you can see below that file content have been written correctly in the file. Now you can play with this file and enjoy.

csv output data in excel sheet

 

 

 

Ajmal Abbasi

Ajmal Hussain Abbasi is a TIBCO Consultant By Profession with more than 6 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

6 thoughts on “TIBCO Tutorial: Create CSV File In TIBCO Designer BW Process

  1. Pingback: TIBCO Tutorial: How to Read CSV File In TIBCO BW Process | Tibco Guide

  2. Glark

    Great tutorial, as usual!

    Just note that since you have a space character after each comma in the first row (Employee Code,Employee Name etc.), all values in the first row except the first one have the space character appended.

    Reply
  3. Pratap

    Good one, have one doubt here.Suppose, if i am fetching big sentence from DB which is having special characters with ,(commas) will it write in single?? if we need to get that saved in single cell what needs to be done.
    Thanks

    Reply
  4. Sunil

    I am also getting the same error as i have payload and in payload there is a character ?>
    after this the payload is written in new row. which is not require. Can you pls help me for this

    Reply
  5. Rachid

    can we use render data that use dataformat to render data into a file ?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *