In this TIBCO Create CSV 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:
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:
When you click on Fetch button and then go to output tab of JDBC Query, it should look like below:
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:
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:
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:
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:
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.
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:
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.
Pingback: TIBCO Tutorial: How to Read CSV File In TIBCO BW Process | Tibco Guide
I want to thank you for the good work you are doing
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.
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
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
can we use render data that use dataformat to render data into a file ?
How to read and parse the xls or xsls(excel) file in tibco bw?
In this case, If we have , (Comma) in any column from the comma data will sit in another row. To overcome this issue do we have any idea?.
Please let us know asap.