Query Prompt Creating Odd Where Condition For = Operator 关注

0
Avatar
Legacy Poster

Using the Database Connection Setup dialog, I've created a query with a field of 'Shipments.Shipment_ID', and operator of '=', and a criteria of '?EnterShipmentID'.

 

After providing a number like '1006' to the query prompt while printing a test label, I examined the log and noticed that it produces the follow WHERE condition:

 

WHERE (("Shipment_ID" >= 1005.95) AND ("Shipment_ID" >= 1006.05)) 

 

Querying for a range of numbers is certainly not the expected result when selecting the '=' operator.

 

I would expect nothing more or less than:

WHERE "Shipment_ID" = 1006

 

3 评论

0
Avatar
Shotaro Ito
版主
评论操作 固定链接

That is normal match condition for double / float value.

Those values are not exact. For some reason bartender's db connection treat your "Shipment_ID" as floating point value. IDs are usually char / text type in data field - what is the data type of "Shipment_ID" in original table?

0
Avatar
Legacy Poster
评论操作 固定链接

That is normal match condition for double / float value.

Those values are not exact. For some reason bartender's db connection treat your "Shipment_ID" as floating point value. IDs are usually char / text type in data field - what is the data type of "Shipment_ID" in original table?

 

The data source is a FileMaker database. Shipment_ID is defined as a number field. Since FM doesn't distinguish between number types when defining the field, it appears that ODBC driver describes the field as a decimal.

0
Avatar
Shotaro Ito
版主
评论操作 固定链接

Hmm.. for decimal, it looks a bit strange to compare like that way, however when input data is integer only, it wouldn't cause problem. If the comparison would cause any problem, consider using text/char type in table instead.

请先登录再写评论。