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
selectto be dependent on whatever the value oftasks.resourceIDis. Is that the case? If so, you'll need to usedependent()to make an Ajax call to the server whenever theselectchanges value (this blog post shows how that can be done).The
Optionswill only make a query to theusers_mastertable - it doesn't know anything about the hosttaskstable, which it why this arises. If you consider that eachtask.resourceIDmight have different options available to it, that's way it needs to get data from the server for each value.Allan