This topic is locked

Multiple Key Column Search in _list.php page

1/13/2010 3:20:44 PM
PHPRunner General questions
G
gluckett author

Hi All,

I want to dynamically pass a list of unique ids to the customers_list.php page:
For example:

http://livedemo.asprunner.net/phprunner/livedemo1/customers_list.php?a=search

&SearchFor=ANATR,ALFKI

&SearchOption=IN

&SearchField=CustomerID
So you can pass using an "ID" a comma delimited list in the list page...this would be endlessly useful.
thanks,

gordon

J
Jane 1/15/2010

Gordon,
you can process this type of search manually in the List page: Before SQL query event on theEvents tab.

Here is just a sample:

if (@$_REQUEST["a"]==search" && $_REQUEST["SearchOption"]=="IN")

{

//add your code here

}
E
ehoff 1/15/2010

Hello,
I have the same question, but for ASPRunner any idea how I should approach this in as the code below gives an error.

Microsoft VBScript compilation error '800a0408'

Invalid character

/Dev/15jan/15-jan3/include/Tool_Table_07_TVA_events.asp, line 23

if (@$_REQUEST["a"]==search" && $_REQUEST["SearchOption"]=="IN")

----^
and will the below works like: http://livedemo.aspr...st.php?a=search&SearchFor=ANATR,ALFKI

etc.?
thanks a lot in advance
Erik

G
gluckett author 1/15/2010

So, if I want to pass this - how would I modify the search string? Using the example above where I pass a comma delimited list? How can I modify the WHERE clause in the code?

if (@$_REQUEST["a"]==search" && $_REQUEST["SearchOption"]=="IN")

{

//add your code here

}
J
Jane 1/18/2010

Gordon,
here is just a sample:

if (@$_REQUEST["a"]==search" && $_REQUEST["SearchOption"]=="IN")

{

$strWhereClause = whereAdd($strWhereClause,$_REQUEST["SearchField"]." in (".$_REQUEST["SearchFor"].")");

}
J
Jane 1/18/2010

Erik,
you need to convert PHP code to ASP:

if REQUEST("a")=search" and REQUEST("SearchOption")="IN" then

'add your code here

end if
E
ehoff 1/18/2010

Jane,
Thanks I have added this to the event, I had to remove the " after search to get this working.

I am desperate looking for the code to get the following working but without luck sofar.

?a=search&SearchOption=IN&SearchField=Control%20ID&SearchFor=01.01.01,01.01.02,01.02.02, etc
Could you help me to solve the issue to provide the results for 01.01.01 and 01.01.02 and 01.02.02 etc depending on the url?

This is the showstopper before golive for me.
regards,

Erik



Gordon,
here is just a sample:

if (@$_REQUEST["a"]==search" && $_REQUEST["SearchOption"]=="IN")

{

$strWhereClause = whereAdd($strWhereClause,$_REQUEST["SearchField"]." in (".$_REQUEST["SearchFor"].")");

}


E
ehoff 1/19/2010

Got it working in the end, the following did the trick for me:
<%

' List page: Before SQL query

Function BeforeQueryList(ByRef strSQL,ByRef strWhereClause,ByRef strOrderBy)
dim countArg

dim strISSArg

dim strTemp
strISSArg = SPLIT(REQUEST("CntlSelection"), ",")
IF UBound(strISSArg) > 0 then

strWhereClause = whereAdd(strWhereClause, "Control_ID='" & strISSArg(0)& "' ")

countArg = 1

END IF
WHILE countArg <= UBound(strISSArg)

strWhereClause = strWhereClause & "OR Control_ID='" & strISSArg(countArg) & "' "

countArg = countArg + 1

WEND

TRIM(strWhereClause)
End Function ' BeforeQueryList

arrAvailableEvents("BeforeQueryList")=true

%>



Jane,
Thanks I have added this to the event, I had to remove the " after search to get this working.

I am desperate looking for the code to get the following working but without luck sofar.

?a=search&SearchOption=IN&SearchField=Control%20ID&SearchFor=01.01.01,01.01.02,01.02.02, etc
Could you help me to solve the issue to provide the results for 01.01.01 and 01.01.02 and 01.02.02 etc depending on the url?

This is the showstopper before golive for me.
regards,

Erik