How can I compare base enums in a query if they're a different type?

In my query I have:
"where purchTable.PurchStatus < salesTable.SalesStatus"

I get an error because “operand types are not compatible”, but I want to compare the integer values. Is there a way to type cast these in a query or something?

This Type of direct comparison is not possible.

You can do like this,

create a enum field in your form,

PurchStatus purchstatus;

purchStatus = global::enum2int(salesTable.SalesStatus);

// In your query you compare like this

Where purchTable.PurchStatus < purchStatus

If you wannt to compare integervalue use the coding,

EX

global::enum2int(ABC::C) // it will return3

It will return integer value

Regards

P.RAM

My query is a “while select” so I can’t just get the value once unless I planned on doing two nested queries. What I ultimately did was:

where purchTable.purchStatus == 1 &&

(salesTable.salesStatus == 1 ||

salesTable.salesStatus == 2 ||

salesTable.salesStatus == 3)

I think I will write a Macro where I can pass it %1, %2 and that will keep it nice looking. Thanks for the help! I was pretty sure I couldn’t do it the way I wanted to, but I’m glad it was verified.