How do I capture the output of tSampleRow/tFileProperties? - talend

I have this flow where I am trying to fetch the details of the last modified file at the SFTP location. While I am able to do that and print the required file's name in the tLogRow component, I am not sure how to use that info to capture more details about the file / pass that info to the tFTPGet component. Any pointers?

Used the tSetGlobalVar with row11.CURRENT_FILE. Can use the global var now.

Related

How can i get the current log file name on runtime from tinylog

i am using tinylog 2 and i want to load the current log file content to show it in my gui.
My tinylog.properties looks something like this:
writer=rolling file
writer.file=project_{date: yyyy-MM-dd}.log
So my problem is: How can i get the current filename of the logger file ?
i can resolve it with hard coded java String formatter, but when someone change the properties file it doesn't fit.
Is there a way to get the current resolved logfile name from Tinylog?
Thanks
tinylog 2 does not provide any specific API for receiving the file name. However, feel free to file a feature request on GitHub. As the main contributor of tinylog, I could imagine to implement such feature for tinylog 2 or 3. Especially, I'm thinking about a listener that could automatically inform you about a rollover event and provide the new file name.

Asammdf extracting more metadata

Hi I am using asammdf library for handling MF4 files. When I open the file using asammdf GUI , in Info tab I can see information . I am trying to extract the same info by calling .info() function on the same file as below.
data = MDF(r"C:\Users\vaasu\Desktop\data\Recorder_2020-06-05_10-22_0120.MF4")
print(data.info())
But this is only giving channel group information. But I need "program identification" and "Measurement comment" as well. How can I read that using asammdf API?
You can see what attributes are accessed starting with this line https://github.com/danielhrisca/asammdf/blob/af1b9b1a213fbfc33a77d41c9d7aca2257e0c320/asammdf/gui/widgets/file.py#L376

talend - log level of tLogRow - log4j

I have a tLogRow component that logs the output of tSetGlobalVar and tContextDump. I have exported the job, and in the zip file I found a log4j which makes me think it is using this for the tLogRow component. Now, my question is how can I specify the log level for the tLogRow component? as I'll be only wanting to see its log on WARN or maybe DEBUG level.
And for my tLogRow component I have checked "Print content with log4j".
Thank you in advance!
This is not the use case of tLogRow component, its just to dislay a flow to console. The check box of using log4j does not change the content of the output, its about to change the api of writing. To change the settings of log4j in Talend, you can go to the top left of screen, the menu file then edit the project properties and you find this screen :
As #54l3d mentioned above, tLogRow component seems not be the ideal component for logging using log4j. I have achieved this via tJava instead:
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(this.getClass());
logger.debug("MY_CONTEXT_NAME: " + context.MY_CONTEXT_NAME);
logger.debug("GLOBAL MAP paramA: " + globalMap.get("paramA"));
For the globalMap's values logging, please note that if the your tJava component that's performing the log is within the same subjob as the tSetGlobalVar, the value you have set will not be immediately reflected. I was only able to log the values set when it is on a different subjob than tSetGlobalVar.

PHPmailer: attaching a session variable to an email

Due to the fact that I have to create a PDF on my server using the uniqid() function, I must subsequently refer to it as a PHP variable in the rest of my code.
The variable that I create for it is a session variable. I later refer to this session variable in a separate file, which contains my PHPmailer code. I use the following line to attach the session variable to the mail:
$mail->AddStringAttachment($_SESSION[$attachment], "attachment.pdf");
The mail is sent correctly with a PDF attached, called attachment.pdf. However, this attached file, attachment.pdf, is empty. This is despite the fact that the PDF on the server, which the session variable refers to, contains the complete set of data. If I attach the name of the PDF, instead of the session variable, it works correctly.
I don't know why the use of a session variable when attaching the PDF is resulting in an empty file being sent. If anybody may be able to explain why this is happening, or suggest an alternative solution, I would greatly appreciate it!
I'm guessing that $_SESSION[$attachment] contains the name of your generated PDF file, so what you are doing here is attaching the name of the file as an attachment, rather than the file itself. You should probably be using this instead:
$mail->AddAttachment($_SESSION[$attachment], "attachment.pdf");

Jenkins How can i upload a text file and use it as a parameter

I have a txt file that is holding a string inside, I want to be able to use this string in one of my scripts, so I'm wondering if there is a way to set the content of the file as one of the build properties or parameters which I'll be able to use in my scripts it should be the same as using one of the build environment properties.
For example : ${JOB_NAME} which is holding the the job name, so in the same way I want to access the content of the file which is holding some value inside.
Is it possible?
You can upload a file from your computer to the workspace through the File parameter of the job.
You can use Extended Choice plugin parameter, to read value(s) from a file and display them in a dropdown/radio-button/checkbox for the user to select, dynamically, every time the build is triggered.
You can use EnvInject plugin to read value(s) from a file and inject them into the build as environment variables, so that they can be used by the rest of the build steps/scripts.
Your question is very unclear on what your are trying to do. Pick one of the 3 methods above based on what you need, or clarify your question.