|
Querystring
Last Post 19 Oct 2007 03:23 AM by steve. 7 Replies.
|
Sort:
|
|
Prev Next |
You are not authorized to post a reply. |
|
steve
 New Member Posts:9
 |
| 16 Oct 2007 02:10 AM |
|
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 |
|
|
|
|
steve
 New Member Posts:9
 |
| 16 Oct 2007 02:14 AM |
|
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 |
|
|
|
|
Richard Edwards DNNStuff Founder
 Veteran Member Posts:1341

 |
| 16 Oct 2007 06:04 AM |
|
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 Did you receive excellent support? Consider leaving a testimonial |
|
|
steve
 New Member Posts:9
 |
| 16 Oct 2007 06:44 AM |
|
Thank you. However, one more question. How do I get the paramater to URL. Do I need any form module? Thank you |
|
|
|
|
Richard Edwards DNNStuff Founder
 Veteran Member Posts:1341

 |
| 16 Oct 2007 06:51 AM |
|
Yes, you'll need some kind of custom module that will postback the page with the querystring parameter added. |
|
Richard Edwards DNNStuff Founder Did you receive excellent support? Consider leaving a testimonial |
|
|
steve
 New Member Posts:9
 |
| 16 Oct 2007 06:57 AM |
|
Great, I though so. Is there any module you recommend to this? I've found H20 from Onyak. Thank you |
|
|
|
|
Duncan Watson
 New Member Posts:4
 |
| 19 Oct 2007 02:57 AM |
|
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 [ ] |
|
|
|
|
steve
 New Member Posts:9
 |
| 19 Oct 2007 03:23 AM |
|
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" /> |
|
|
|
|
| You are not authorized to post a reply. |
|
Active Forums 4.1
|