Skip to content
+1-888-319-3663

COMMUNITY FORUM

Trying to exclude 0.0000 amounts from my file in the Restriction on the map but not working

Brenda Hopkins asked 3 years ago
Here is my statement, what am I doing wrong?
if _AMOUNT <> ”0.00”
return true
end if
Answers
Patrick Roth Staff answered 3 years ago
Brenda,
We can’t tell what your _AMOUNT field is here.  Is it a string?  Is it a numeric?
Yes, I know that it meant to be a currency amount – but we don’t know the underlying datatype that SC is using here.  But I’d guess numeric since this is an “amount”.
Assuming that, it is always a bad idea to cast data if you don’t have to.
Here if _AMOUNT is truly numeric, you are comparing it to a string forcing vb to cast either the string to a numeric or else cast the numeric to a string to compare them.  My guess would be the latter since you say it fails.
so your statement should like be
if _AMOUNT <> 0 then
  return true
else
  return false
end if
 
 
Brenda Hopkins replied 3 years ago

this column is “Col4=F4 Float ” from my text file schema. This still does not restrict the data. the data shows a 0 in the preview.

Ethan Sorenson Staff replied 3 years ago

Brenda,

A restriction does not change what is shown in the preview. These scripts aren’t used until the map is actually run. Therefore you will need to run the map and check the output to see if the restriction executed correctly or not.

Your data source is a text file, which means if needed these lines can be removed at a data source level if you never need them mapped. Simply use an ODBC data source pointed to the text file, and filter all amount fields that meet your criteria.
https://www.eonesolutions.com/odbc-text-file-connection/


If you would like to submit an answer or comment, please sign in to the eOne portal.