Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
asafrian1700127126
Contributor III
Contributor III

Using tfileproperties to get size returns null Talend

I use tfileproperties to get the size of a file but it produces null

asafrian1700127126_0-1711088107203.png

I have expression below

row2.size!=null?"Create XML Success, With Size = "+Long.toString(row2.size/1024)+" KB":"Create XML Success, With Size = "+row2.size+" KB"

But return null

asafrian1700127126_2-1711088469909.png

asafrian1700127126_4-1711088700136.png

 

even though the file is formed and its size is 5kb

asafrian1700127126_3-1711088568800.png

Can anyone help me why it produces null when it should contain a value?

Labels (3)
1 Solution

Accepted Solutions
Shicong_Hong
Support
Support

Hello

The result of this calculation row2.size/1024 is an integer, because the file size is too small (5 KB less than 1024), so its result is 0. You will have the exact file size with the expression:

row2.size!=null?"Create XML Success, With Size = "+row2.size+" KB":"The file is empty"

Regards

Shicong

 

View solution in original post

2 Replies
F_B
Specialist
Specialist

Ensure that you are passing the correct file path to the component. If the file path is incorrect, it may result in null values.

Shicong_Hong
Support
Support

Hello

The result of this calculation row2.size/1024 is an integer, because the file size is too small (5 KB less than 1024), so its result is 0. You will have the exact file size with the expression:

row2.size!=null?"Create XML Success, With Size = "+row2.size+" KB":"The file is empty"

Regards

Shicong