This topic is locked
[SOLVED]

 Search Master and Details tables together

2/28/2018 12:14:37 PM
ASPRunner.NET General questions
T
Tim author

Has anyone done this PHP tip/trick in ASP.Net?
http://asprunner.com/forums/topic/24763-search-master-and-details-tables-together/pagehlsearch%20detailsfromsearch1
This is exactly what I need to do but I can't figure out how to transpose the PHP to ASP.Net.
For reference, here is the PHP:


$srchObj = SearchClause::getSearchObject("orders");
$value = $srchObj->getFieldValue("product");
if( $value != null ) {

$srchObj->setSearchSQL("product", "OrderID in (select OrderID from OrderDetails where ProductName like '%$value%')");

}


Thanks,

Tim

T
Tim author 2/28/2018

That first post is the real question. I am adding this for context, and in case it generates any thoughts. It is long so feel free to disregard, but, if interested, read on.
Below is the question I was going to ask. Before posting it I did one more search to see if I could find a solution in the forum and I found the PHP tip referenced above. This is exactly what I'm trying to do, so I think the previous post is the real question. Here is what I was going to ask.
------------

I think the short version of the question is; how to stop the ajax lookup on a search text field?
Here is the situation (long version). I have a master/details setup with the tables "Recipe" (master) and "RecCat" (details - short for recipe categories). The details table has 2 fields, RecID and CatID. The CatID is a lookup to a tables called "Categories". So recipes can belong to multiple categories.
So back on the "Recipe" master table, I want to search for all recipes that are in a certain category. How I accomplish this is, in the query of the Recipe table, I create a field that is a comma separated list of all categories the recipe belongs to (I do this via "Stuff(( select ... For XML Path('') ), 1, 1, '') as Categories", which is a trick that may only work with MSSQL, i'm not sure). So now I can add the "Categories" field to the search panel and find all recipes that are in a certain category.
The problem is each recipe has a "Categories" field that is like "Cookies, Sweet, Gluten Free" or "Cookies, Nuts". So when a user starts to type "cookies" in the "Categories" search field, 2 choices popup (in this example). If they just type the word "cookies" and then hit the search button, it works correctly and they get both recipes. But users like to pick from the list, so they end up only getting the recipe that matches "all" categories in the list.
So my thought was, if I can stop the popup list and just let/make them type in what they want, this should work.
But I guess I'm also wondering how others deal with this. Has anyone come up against this?
I hope this makes sense.
-----------
If anyone is still reading, sorry for the long post.

Thanks,

Tim

T
Tim author 2/28/2018

NEVER MIND! I found the exact same tip in the ASP.Net manual.
https://xlinesoft.com/asprunnernet/docs/searchapi_set_search_sql.htm
Luckily it looks like I'm just having a conversation with myself so far, so hopefully I didn't waste anybody's time.
Thanks,

Tim

Pete K 3/1/2018



NEVER MIND! I found the exact same tip in the ASP.Net manual.
https://xlinesoft.co..._search_sql.htm
Luckily it looks like I'm just having a conversation with myself so far, so hopefully I didn't waste anybody's time.
Thanks,

Tim


LOL. I find posts like this helpful anyway. I just learned something I didn't know and can file it away for future reference.