.toLong() not working

.toLong() not working

I have a user defined function that calls .toLong() built in function

I have added it to one line and it works fine. I tried adding it to another line of code but I get the following error. Is anyone else experiencing this issue? How can I overcome it?

Not able to find 'toLong' function