Notifications
Clear all

SearchCustomData with more than one search operation

(@bennik)
Active Member Registered

I have usefiles with more than one custom attribute.
Example
type: level
maxplayers: 6

I want to filter for exactly type "level" and maxplayers "6".
I tried it this way

List<SearchCustomData> searchData = new List<SearchCustomData>();
searchData.Add(new SearchCustomData(
				"type", eSearchOperator.Equals, 
				"level"));

			searchData.Add(new SearchCustomData(
				"maxplayers", eSearchOperator.Equals, 
				"6"));

If I search just for one of those two it works. But not in combination.

It this possible at all?
I checked what kind of sql query is generated at the end and it looks to me that the way the query is build it can't work.

SELECT * FROM `combu_UserFile` WHERE ShareType = 0 
AND (Id IN (SELECT DataId FROM `combu_UserFile_CustomData` WHERE
 (DataKey = 'type' AND DataValue = 'level') AND (DataKey = 'maxplayers' AND DataValue = '6'))) ORDER BY lastmodified DESC LIMIT 15

 

 

 

 

ReplyQuote
Topic starter Posted : 24/03/2021 8:05 pm
(@skaredcreations)
Prominent Member Admin

You are right, the above query cannot work, so that means that nobody else used it to filter for more than one field or at least I didn't receive a report about it.

I will fix it and get back to you with a new code for that server method.

Thanks for the report.

FRANCESCO CROCETTI @ SKARED CREATIONS

ReplyQuote
Posted : 25/03/2021 8:11 pm
Share: