0

I need to write a query that returns all entries that have a certain decimal attribute that begins with a certain number string.

Something like

...
WHERE TO_STRING(numerical_attribute) LIKE '%' || my_substring
...

So, for instance, if query the entries where the decimal attribute beings with "92", I'd like to recover, for instance, those entries where the attribute = 92, 924, 92.40, 92345592, etc.

Is there anyway to write that in the FetchXML filter? I tried this:

<filter>
    <condition attribute='numerical_attribute' operator='like' value='my_substring%' />
</filter>

But CRM returns that it is expecting a decimal value in "value".

Heathcliff
  • 3,048
  • 4
  • 25
  • 44

1 Answers1

1

MSDN doesn't provide a good documentation about FetchXML operators, but we can assume that the like operator requires a string attribute for matching.

The obvious workaround is to create a text field inside your entity and keep it synchronized with the decimal value.

Guido Preite
  • 14,905
  • 4
  • 36
  • 65