Stackapps search parameters?


(Tim Oppenheim) #1

Hi Everyone!

I know this is just the simplest thing, but I am trying to usr the StackApps search stack. I have set the parameter for the field and passing it off to my target page, but my “where” clause is not picking it up.

Do I have to format it, some way? I have transaction_id = number_id and number_id is my passed parameter. I have tried everything and am lost.

By the way, StackApps is great, have we not head from the developer lately?

Tim


(Michael) #2

@timopp
I don’t know your whole setup, so this is one of my setups for a category image search
Image table = lightbox
category table = lightbox_cat

This stack shows all categories
Lister stack -> select from lightbox_cat
Text field in Lister stack -> field = category
Text field action
type: static
Params: search=category

This stack shows the thumbs of the gallery
Lister image gallery
Select * from lightbox WHERE category LIKE “%param(search)%”

Try to aadapt it to your needs

best Michael
have a look here for some more info
tutorials.mvbartwork.de


(Tim Oppenheim) #3

Michael,

Thanks you. I was able to get that fixed.

Can you help me with joins?


(Michael) #4

Tim,
What Kind of join you wankt to build?
Real Table Joins are not supported, but you can reference to another table field, but if you want to use the search for this reference it’s a bit more difficult in that case I use the ID field as Text instead of a number field.


(Tim Oppenheim) #5

My application has Table donors and Table transaction. I am trying to join the two using the pin-nbr field in both tables. I want to pull the donor_name from donors using the join for the given pin_nbr

How could this be done?

Again, that for your help


(John Splashost) #6

Hi Tim,

Try changing the value field to be donor_name instead of pin_nbr.

Cheers,

John


(Tim Oppenheim) #7

Bless you. So for others, field in the Text Fields stack was pin_nbr from my transaction table. Index field in the heads up was pin-nbr from table donors and Value Field was donor_name.

Also, we need more love for StackApps, they are so cool.


(Jon Norris) #8

Could you outline how to use the search stack please? I’ve written the whole query by hand in my own php page but now using stackapps can’t see where to put what in the stacks to get the input form. 1)set up stack 2) search stack…Maybe inside a Lister
Actually trying to search a database of books. At present the user chooses from a drop down of ‘author’, ‘title’, or ‘keyword’ and types their word (s) into a search box


(Tim Oppenheim) #9

On my search page ( assuming you have the database connection set) I created a parameter ( number_id) and the used the Table Grid to produce results. I set the parameter previously defined to equal the column name in the table I was searching for.

And then in my column drop zone I added the other columns from the table.

I hope that helps


(Jon Norris) #10

Thanks for your help, but I can’t get it to work at all, sadly.

Search stack - in Action it transfers 'searchauthor’
Input stack within Search stack - in Field, I put 'searchauthor’
So ‘searchauthor’ is a madeup name simply to pass whatever the user types into the Search field on the web page (I typed ‘Jon’), onto the Lister stack so it can list the results.
Indeed the URL becomes “search.php?searchauthor=Jon”

Lister stack then selects from my table WHERE author = param(searchauthor)
author is a column in my table, and it should find searchauthor’s value from the search
But it doesn’t.

Something obvious is missing somewhere but though I thought I could write the query in SQL I have no idea how to add into the stacks


(Tim Oppenheim) #11

Looking through the one page that I have a Search / Lister Stack that looks like mine. Have you double checked your DSN to make sure your DB Connection is right. On mine it got mad that I didn’t have the order_by function correct, but after that no hassle.

I love StackApps and would love to see more…updates, examples, users, and documentation. I even sent some beer money. Helmut if your out there please come back.


(Jon Norris) #12

Hoping mvb or someone can chip in?
Answering Tim, Yes, I use AMPPS, and the whole site works, all except the search. It seems only to search and find the occasional things it wants to, but usually nothing.
I notice in one example someone had put paramint, but you used just param.
Maybe I’ll try paramvarchar but to be honest I’m tiring! I’ll just use my hand written sql one!

There are so many stacks to explain but when this is finished I’ll put it somewhere as an example. Stackapps needs examples, but where to put them?


(kris ) #13

This post was flagged by the community and is temporarily hidden.


(Jon Norris) #14

Didn’t get the usual email notification - thanks. It sure is hard work working out what Stackapps means…

Thank you.

In the ‘Search’ stack, ‘Action’ Transfer: search (or search author in my case)

I haven’t done that and it still works! With or without that transfer field filled in either or both Search and Lister stack - seems to have no effect.

Now to stop the Lister stack from listing all 20,000 books without waiting for the input from the Search!

author LIKE ‘%param(searchauthor)%’ is in the Lister stack but it does its job of listing without waiting for input!


(kris ) #15

This post was flagged by the community and is temporarily hidden.


(Jon Norris) #16

It’s not that, it’s that when the search page is called, the Lister stack has already populated the page with all the books in the database, then when you input a search query the Lister stack just shows the ones asked for.
There must be a way to tell the Lister stack to hang on a moment!
And anyway its sql statement has the search parameter in, so even refreshing the page doesn’t help.
Will try playing with the parameter settings next …


(Jon Norris) #17

Solution at the moment is to produce the results on a new page.
Stackapps is cool…


(Daniel Manchester) #18

Thanks for posting this, it took me several attempts… actually i lost count but finally figured it out.

I didn’t have my primary keys in the right fields, and it works great.

Thanks again.