Display calculated number in a text field

Go into your data collection and delete that empty line. It usually adds a new line if you enter records using keyboard and TAB keys. So if you get an empty line in your code there is a empty line inside your data collection.