473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

A good pattern for complex search criteria?

I am currently working on a store search function. The search criteria are quite complex, for example:


Expand|Select|Wrap|Line Numbers
  1. Footage >= 50 AND (SizeCode == SizeType.Large OR MobileEnd == "ABC") 

I think that each criterion could be represented by a Func<store, boot> (I am using C# and LINQ).

Expand|Select|Wrap|Line Numbers
  1. Func<Store, bool> filter1 = (s => s.Footage >= 50);
  2. Func<Store, bool> filter2 = (s => s.MobileEnd =="abc");
  3. Func<Store, bool> filter3 = (s => s.SizeCode == SizeType.Large);

My question is how I can deal with AND, OR, NOT logic, and order of precedence. How can I convert the user input into a LINQ expression?

Thanks.
Dec 21 '14 #1
1 1633
Of course. We know every criteria are important and very critical of what we do. If you have great criteria to use it, make sure that you have a successful future to come.
Dec 22 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: wbekker | last post by:
Hi, I'm searching for a good pattern for the following problem: In a large object tree, all object implement a property called IsDirty. That flag is set when a property is modified. If a child...
1
by: Casey | last post by:
Hi, How would one allow for possible multiple search criteria using FREETEXTTABLE. For example, my table "listings" has a full-text search catalog, and I may want to: SELECT * FROM listings...
1
by: James890 | last post by:
I want to enable a user to enter a start and end date to define the period they want to search for records of members who joined on certain dates. Funny thing is...I've got it to work half of the...
3
by: AishaKhalfan | last post by:
Hi, :wave: I have many search criteria in my program, such as: search by name, search by age, search by gender, search by city the user can search by name only, or by name and age, or by...
0
by: Samita | last post by:
Hi , I am doing a search criteria for employee where i want to search employee by allotment year in a text box, that too by entering the last 2 digits of year in the text box. what is the logic...
1
by: Samita | last post by:
I want to do an employee search in an employeemaster page with email id as the search criteria in vb.net.How to achive that,any email validation is needed while searching?
5
by: LC2007 | last post by:
Hello, Can someone please help me on how to create Search Criteria form, i can't find exactly what i am looking for!!! i need a search button! but i can't find anything that can help me!
7
by: veliscorin | last post by:
hi experts, the topic is rather misleading but i couldn't find a better way to phrase it.. here's my scenario: Table A: Products Table B: Attributes (with a product_id to show which product it...
4
by: sanika1507 | last post by:
Can you help me out please ! This is a search Stored procedure that returns the list .of patients .i want to include the start and end date in the search criteria So you will need to accept the...
5
by: Gwyn Jones | last post by:
I am using an example code to filter a form which lists records from a table. The example database provided allows users to filter records with multiple criteria fields. However, since I have made...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.