Page 1 of 1

Error in field data type

Posted: Sat 07 Oct 2017 11:47
by jjmorlan
When in VirtualQuery I use a statement that uses count or sum functions when extracting the field in the field editor it brings me a Memo field. Data type should be Float or numeric type, but extracting ftMemo. Why does this happen?

Re: Error in field data type

Posted: Wed 11 Oct 2017 09:53
by MaximG
VirtualQuery is built using the SQLite engine. When the SQLite engine cannot determine the type of the field returned by the query, we create the corresponding Field of the Memo type. In order for such fields to be created with the type required by a developer, you can use DataTypeMapping, a special mechanism provided by our components. You can use this feature both in Design Time with the help of VirtulalQuery Editor, and in Run Time:

Code: Select all

VirtualQuery.DataTypeMap.AddFieldNameRule ('SumResult', ftInteger);
where 'SumResult' is the name of the field returned by the query.