| Author | Messages | |
stepan
 Member Posts:9
 | | 10/16/2007 1:10 AM |
Alert | | Hi,I made a table with several columns. Now I need to put some filter there to show only some items, for example only items where price is over some amount. But I need this filter to be floating, so that I can set up the filter as is needed. I guess querystring is the right tool for ir, unfortunately I have no clue how to use it - where to write it and how the format should look like. Can you please help me, or can you give me an example. Thank you very much, Stepan | | | |
| stepan
 Member Posts:9
 | | 10/16/2007 1:14 AM |
Alert | Here is the string: SELECT TabSaldo.CisloOrg as [C. Org],VSaldoOrg.Nazev as [Název],TabSaldo.ParovaciZnak as [Párovací znak],cast(tabSaldo.Saldo_Ucet as int) [Částka CZK],TabSaldo.DatumSplatno as [Splatno Dne], DateDiff("d",TabSaldo.DatumSplatno,getdate()) as [Dnů] FROM TabSaldo LEFT OUTER JOIN TabCisOrg VSaldoOrg ON TabSaldo.CisloOrg=VSaldoOrg.CisloOrg WHERE (TabSaldo.CisloSalSk='100') I'd like to see for example only items where this item (tabSaldo.Saldo_Ucet) is over 10 000. tabSaldo.Saldo_Ucet=price Thanx | | | |
| dnnstuffadmin DNNStuff Founder
 Site Member Posts:1261

 | | 10/16/2007 5:04 AM |
Alert | The querystring parameter is simply placed in the sql query and then the contents of that is replaced.
For example, the following query uses the querystring parameter p1:
select * from tabs where tabname like '[QUERYSTRING:p1]%';
When the page is shown, the querystring value of p1 is replaced in the query. Lets say the url to the page is http://localhost/dnn462/Home/tabid/36/Default.aspx?p1=S
The value of p1 (S) is replaced where the [QUERYSTRING:p1] string resides, so you end up with:
select * from tabs where tabname like 's%';
In your case, you would do something like:
SELECT TabSaldo.CisloOrg as [C. Org],VSaldoOrg.Nazev as [Název],TabSaldo.ParovaciZnak as [Párovací znak],cast(tabSaldo.Saldo_Ucet as int) [Částka CZK],TabSaldo.DatumSplatno as [Splatno Dne], DateDiff("d",TabSaldo.DatumSplatno,getdate()) as [Dnů] FROM TabSaldo LEFT OUTER JOIN TabCisOrg VSaldoOrg ON TabSaldo.CisloOrg=VSaldoOrg.CisloOrg WHERE (TabSaldo.CisloSalSk='100') AND (TabSaldo.Saldo_Ucet=[QUERYSTRING:price])
On your querystring, you'd need to add the parameter such as:
http://localhost/dnn462/Home/tabid/36/Default.aspx?price=123.45
or
http://localhost/dnn462/Home/tabid/36/price/123.45/Default.aspx
I hope this helps.
| | Richard Edwards DNNStuff Founder | |
| stepan
 Member Posts:9
 | | 10/16/2007 5:44 AM |
Alert | | Thank you. However, one more question. How do I get the paramater to URL. Do I need any form module? Thank you | | | |
| dnnstuffadmin DNNStuff Founder
 Site Member Posts:1261

 | | 10/16/2007 5:51 AM |
Alert | | Yes, you'll need some kind of custom module that will postback the page with the querystring parameter added. | | Richard Edwards DNNStuff Founder | |
| stepan
 Member Posts:9
 | | 10/16/2007 5:57 AM |
Alert | | Great, I though so. Is there any module you recommend to this? I've found H20 from Onyak. Thank you | | | |
| duncanwatson
 Member Posts:4
 | | 10/19/2007 1:57 AM |
Alert | Hi, I just put the querystring as a link wrapped in HTML and executed in a SQL statement and run that report on the same page. So you get a link showing on page so a user just clicks and sends the querstring back to the same page. Works great! (although hard to explain!!). Here is the code I used below;
set @CharAuditID='[QUERYSTRING:t1]'
-- set Audit to current tree if no parameter passed if IsNumeric(@CharAuditID)=1 set @AuditID=convert(int,@CharAuditID) else set @AuditID=jigsaw.dbo.GetCurrentAuditID()
-- Navigation declare @NextAuditID int declare @PriorAuditID int set @NextAuditID=[Jigsaw].[dbo].[GetNextAuditID](@AuditID) set @PriorAuditID=[Jigsaw].[dbo].[GetPriorAuditID](@AuditID)
declare @Desc nvarchar(50) set @Desc=(select [Desc] from jigsaw.dbo.AuditTreeInfo where AuditID=@AuditID)
select '<P align=left><A href="http://www.jigsaw.net/portal/Recognition/MonthlyAwards/tabid/65/Default.aspx?' +'t1=' +rtrim(convert(char,@PriorAuditID)) +'" title="Click to show Prior Period Awards">' +'<IMG src="http://www.jigsaw.net/Portal/Portals/0/Icon_btn_previous.gif" border=0 align=absMiddle title="Show Awards for Previous Period">' --Show Previous Period +'</A></P>' as [ ],
'<P align=right><A href="http://www.jigsaw.net/portal/Recognition/MonthlyAwards/tabid/65/Default.aspx?' --+rtrim(convert(char,@TabID)) +'t1=' +rtrim(convert(char,@NextAuditID)) +'" title="Click to show Next Period Awards">' --Show Next Period +'<IMG src="http://www.jigsaw.net/Portal/Portals/0/Icon_btn_next.gif" border=0 align=absMiddle title="Show Awards for Next Period">' +'</A></P>' as [ ] | | | |
| stepan
 Member Posts:9
 | | 10/19/2007 2:23 AM |
Alert | Thanks lot, I already found some solution - Javascript. I wrote this code: <script type="text/javascript"> function vlozit() { var prvek=document.getElementById('price'); window.location="http://...?price=" +prvek.value } </script>
Price: <input id="price" type="text" /> <input type="button" onclick="vlozit()" value="Send" /> | | | |
|
|