Logical and mathematical expressions

Hello, I want to make a math calculation before deleting Time tracker records, which is a custom application. but it gives an error because it is a subtraction process. when I apply the same procedure with the document, it does not do the operation although it does not give an error.

many methods have been tried. In version 24.3 I encounter this problem,

fx : -entity.TimeSpent_c+entity.RelatedRecords_c.ToplamEfor_c --> DIRECT ERROR

fx: ${entity.RelatedRecordsRequest_c.ToplamEfor_c -(entity.TimeSpent_c)} --> NOT ERROR BUT NOT WORKING

Logical algorithm is here;

DOCUMENTATION :