You can try to solve this problem by adding few more components to your job like tMysqlInput and a tSetGlobalVar component and setting up your job as shown:
Once done, go to the component tab of tMysqlInput_1 type the given query:
select TYPE from my_table limit 1;
In the tSetGlobalVar component, specify the key-value pair:
key = "file_name", value = (String)row1.type
Now, go to the tMysqlInput_1 and specify the input table and proceed to map the data.
In the “File Name” field of the tFileOutputExcel, specify the below expression to name it based on the output:
Note that this is not the only solution. There are n number of ways to achieve the same result. But among all, I feel this is the easiest one. Hope this helps!!
To know more about Talend, join Talend for big data certification training today.