Add integer to a body message

One Star

Add integer to a body message

Hi,
i'm using tSendMail and i would like to send the variable :
((Integer)globalMap.get("tFileList_1_NB_FILE")) in the message body.
i got an error when i try to add it.
Type mismatch: cannot convert from Object&Serializable&Comparable<?> to String
how can i convert it to string?
Thanks
Shahar
Moderator

Re: Add integer to a body message

Hi,
The ((Integer)globalMap.get("tFileList_1_NB_FILE")) stands for the number of your files and it must return to "Integer".
If you want to send your files in Local Disk, I think you should choose the ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Add integer to a body message

Hi,
i'm trying to get the number of files loaded.
is there another way to do it?
thanks
Shahar
Moderator

Re: Add integer to a body message

Hi,
You can use ((Integer)globalMap.get("tFileList_1_NB_FILE")) in component tFixedFlowInput.
See my screenshots for details
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Add integer to a body message

String.valueOf((Integer)globalMap.get("tFileList_1_NB_FILE"))
Moderator

Re: Add integer to a body message

Hi,
String.valueOf((Integer)globalMap.get("tFileList_1_NB_FILE"))

I'm afraid to say it is not a good option. ((Integer)globalMap.get("tFileList_1_NB_FILE")) is used to get the number of files loaded, and the result is Integer, (such as, 1,2). If you convert it to "String", I wonder what is the sense of this Global variables?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Add integer to a body message

Did you read the shahark's post? He/she wants to put the number of files in an email message body as info, so the value has to be converted to a string as the message body is a string.
Moderator

Re: Add integer to a body message

Hi kelebek,
You are right, I made a misunderstanding about that. If the e-mail message body include the number of files loaded, String.valueOf((Integer)globalMap.get("tFileList_1_NB_FILE")) is necessary. My suggestion in #4 only let user see the number of files loaded in studio. Thanks for your correction and precise help.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Community Manager

Re: Add integer to a body message

or you can set the expression of body as:
""+((Integer)globalMap.get("tFileList_1_NB_FILE"))
or
"The total number of processed files is: "+((Integer)globalMap.get("tFileList_1_NB_FILE"))
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: Add integer to a body message

Hi

 

How can send mail if files are not there using tFilelist havig xlsx files.

If files are present i need to run my job.

I am using ((Integer)globalMap.get("tFileList_1_NB_FILE"))>0 (if files present it has to run job)

((Integer)globalMap.get("tFileList_1_NB_FILE"))==0 (send mail if files are not present 

 

Thirteen Stars

Re: Add integer to a body message

@Lakshmi2411,check this should work.

 ((Integer)globalMap.get("tFileList_1_NB_FILE"))<0

Manohar B