Forums: [SOLVED] Search Master and Details tables together - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

[SOLVED] Search Master and Details tables together PHP tip translation to ASP.Net Rate Topic: -----

#1 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 248
  • Joined: 21-September 07

Posted 28 February 2018 - 05:14 PM

Has anyone done this PHP tip/trick in ASP.Net?

http://asprunner.com...__fromsearch__1


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
0

#2 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 248
  • Joined: 21-September 07

Posted 28 February 2018 - 05:33 PM

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
0

#3 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 248
  • Joined: 21-September 07

Posted 28 February 2018 - 06:24 PM

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
0

#4 User is offline   Pete K 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 218
  • Joined: 05-February 16

Posted 01 March 2018 - 12:00 PM

View Posttimnorvel, on 28 February 2018 - 01:24 PM, said:

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.





----------------------------------------------------------
Pete K.
Web Developer
Fayette County Public Schools | Lexington, Kentucky, USA
0

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked