TheClymb/netsuite-rest-client — pull request #6 by hexgnu (2014-12-29 18:42:57+00:00)
Title: Weird rest.js logic for formula searches

What
=====

I have been trying to get a custom search working that is dynamic and have to use the CASE WHEN syntax for making it work.

The problem I'm encountering though is a type problem. Most of the time netsuite works but sometimes it just fails cause it's casting dates as strings and throwing an error for me.

This takes out the formula logic to just let someone code a formula directly.

So instead of

```ruby
query = {
formulatext: {
formula: {
field: 'trandate',
values: [date.strftime('%m/%d/%Y')],
comparison: '=',
join_operator: 'OR'
},
operator: :is,
value: 1
}
}
```

It'd be

```ruby
query = {
formulatext: {
formula: "CASE WHEN {trandate} = '#{date.strftime('%m/%d/%Y')}' 1 ELSE 0 END"
}
}
```

Personally I think this gives more control and is easier to use... Thoughts?