Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (2)
10 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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

Hi,
You can use ((Integer)globalMap.get("tFileList_1_NB_FILE")) in component tFixedFlowInput.
See my screenshots for details
Best regards
Sabrina
0683p000009MEQE.png 0683p000009MECh.png
Anonymous
Not applicable
Author

String.valueOf((Integer)globalMap.get("tFileList_1_NB_FILE"))
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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.
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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