Column Comparison Datatype in OrWhere
Column Comparison Datatype in OrWhere
I'm doing an OrWhere on a select list option list in my controller (.net).
.Field(new Field("tasks.resourceID")
.Options("users_master", "userID_DVPR", "fullName", q => q.Where("roleID", "4", "<>").OrWhere("users_master.userID", "tasks.resourceID", "="))
.Validator(Validation.DbValues()))
I'm trying to populate the select list with the resource (even if they are a deleted user, would be default selected) OR all users that are not deleted. The error I get is on the OrWhere when comparing the two fields - userID is an INT, resourceID is an INT in the database but has been converted to a string (I believe) in the JSON.
How can I compare the same datatypes in the OrWhere?
This discussion has been closed.
Answers
It looks like you want the content of the
select
to be dependent on whatever the value oftasks.resourceID
is. Is that the case? If so, you'll need to usedependent()
to make an Ajax call to the server whenever theselect
changes value (this blog post shows how that can be done).The
Options
will only make a query to theusers_master
table - it doesn't know anything about the hosttasks
table, which it why this arises. If you consider that eachtask.resourceID
might have different options available to it, that's way it needs to get data from the server for each value.Allan