Are you certain that the minus sign in the listing of allowed characters is the same character as a minus sign in your data? If not, the string.allow function will be removing the minus sign.
What value is printed for the log.notice call? Does it still include minus sign?
What value would be printed if you displayed the value in mswtd? Is this value negative when appropriate?
Your code should actually test for a nil value before you use string.allow, then there would be no need for the if statement.
I tried running your logic natively in datascript and was able to retain the minus sign:
C:\Program Files (x86)\expressor\expressor3\bin>datascript QlikView Expressor datascript utility (datascript) 22.214.171.12433 n (Build 24933) May 2 2013 Copyright (C) 2003-2012 expressor software corporation > EMPLOYEE_WAGES='-123.45' > wages = string.allow(EMPLOYEE_WAGES,'-01234567890.'); > print(wages); -123.45 > > mswtd=todecimal(wages); > if (mswtd~=nil and mswtd~=0) then WageAmount = mswtd; end; > print(WageAmount) -123.45 >