Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Monday, March 26, 2012

How do I jump to another report based on a value in my current report? report has no parameters.

How do I jump to another report based on a value in my current report. The report that I am jumping from has no parameters, just values.

Hello,

Does your target report have parameters? For example, you want to go to the target report and run it with the value you selected on the current report?

Or are you saying... If the field value is between a and b, go to report 1, if it's between b and c, go to report 2, otherwise go to report 3.

Can you explain a little more about your situation?

Jarret

|||

the report I am jumping from has no parameters. I want to be able to click on a value and have it jump to another report. That report possibly being jumped too might or might not have parameters.

I just used the following expression and it works to a degree, but it enables all the values in the column for jumping, rather than just the report I want

=iif(Fields!YN_DESC.Value="A","Report 1","Report2")

|||

Sorry for the delay...

This will only enable the "A" values to jump to a report (Report 1), any other values will not have the jump to enabled.

=Switch(Fields!YN_Desc.Value = "A", "Report 1")

If you need to add additional conditions... Example, if the value is "C" - Report 31, "D" - Report 7.

=Switch(Fields!YN_Desc.Value = "A", "Report 1",
Fields!YN_Desc.Value = "C", "Report 31",
Fields!YN_Desc.Value = "D", "Report 7")

Hope this helps.

Jarret

How do I jump to another report based on a value in my current report? report has no parameters.

How do I jump to another report based on a value in my current report. The report that I am jumping from has no parameters, just values.

Hello,

Does your target report have parameters? For example, you want to go to the target report and run it with the value you selected on the current report?

Or are you saying... If the field value is between a and b, go to report 1, if it's between b and c, go to report 2, otherwise go to report 3.

Can you explain a little more about your situation?

Jarret

|||

the report I am jumping from has no parameters. I want to be able to click on a value and have it jump to another report. That report possibly being jumped too might or might not have parameters.

I just used the following expression and it works to a degree, but it enables all the values in the column for jumping, rather than just the report I want

=iif(Fields!YN_DESC.Value="A","Report 1","Report2")

|||

Sorry for the delay...

This will only enable the "A" values to jump to a report (Report 1), any other values will not have the jump to enabled.

=Switch(Fields!YN_Desc.Value = "A", "Report 1")

If you need to add additional conditions... Example, if the value is "C" - Report 31, "D" - Report 7.

=Switch(Fields!YN_Desc.Value = "A", "Report 1",
Fields!YN_Desc.Value = "C", "Report 31",
Fields!YN_Desc.Value = "D", "Report 7")

Hope this helps.

Jarret

Friday, March 23, 2012

How do i insert variables?

into database.

Is there any other way except using parameters? and if there isn't, how can i insert 2 parameters in the same query?

Please be more specific: Are you trying to insert a record into a table doing raw SQL? (using a "SqlConnection" and a "SqlCommand" field?)

Or are you using a SqlDataSource and trying to tap into the "InsertCommand" property?

Thanks,

|||

while not recommended, you can dynamically create your sql string (insert statment) using your code...

if you want to do more than one parameter, just add a new one

 ParameterCollection coll =new ParameterCollection();// add a parm coll.Add(new Parameter("blah", TypeCode.String,"hello")); coll.Add(new Parameter("other", TypeCode.Int16,"1"));string sql ="insert into something (field1, field1) values (@.blah, @.other)";
You didn't mention if this was for a sqldatasource, objectdatasource or something else, so this is rather generic... but you can just add(new parameter()) to your sources parameters collection.|||

Sorry for not being specific, didn't know it makes a difference. here is an example code

using System;using System.Data;using System.Data.SqlClient;using System.Net;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass Register : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) { }protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn =new SqlConnection("server=(local); database=phynew;integrated security=true"); conn.Open();try {string aaa ="test1";string bbb ="hello2"; SqlCommand myCommand =new SqlCommand(); myCommand.Connection = conn; myCommand.CommandType = CommandType.Text; myCommand.CommandText ="INSERT INTO tblAdmin (username, pwd) Values(aaa ,bbb)"; myCommand.ExecuteNonQuery(); }catch (SqlException err) { TextBox2.Text = err.ToString(); }finally { conn.Close(); } }}
|||

Cool, you're almost done!

myCommand.CommandText ="INSERT INTO tblAdmin (username, pwd) Values(aaa ,bbb)";

That's your code... change it to this:

myCommand.CommandText ="INSERT INTO tblAdmin (username, pwd) Values(@.aaa ,@.bbb)";

Then all you have to do is this:

myCommand.Parameters.AddWithValue("@.aaa", "Hello!!!");
myCommand.Parameters.AddWithValue("@.bbb", 123);

You can put strings, numbers, a boolean or whatever as the value.

Peace, (and please mark this as the answer when you get it working)

|||thanks, it works now.

How do I include all dates between 2 parameters in a table?

I'm working with a data set where some values have an aggretate total
(for example, a count of something) in a certain date range and others
do not. The problem I am having is that I need each page of the report
to show all the possible dates and the display a 0 when there are no
values for the date. Currently it is dropping that date.
For Example:
@.StartDate = 1/1/06
@.EndDate = 6/31/06
-- I get this on grouped values where there are empty months:
Jan06 5
Feb06 3
Apr06 7
Jun06 10
-- But I want this:
Jan06 5
Feb06 3
Mar06 0
Apr06 7
May06 0
Jun06 10
Due to other report properties and calculations, I can't really modify
my query to fix this problem. It seems like it should be easy to solve
but I'm not getting it!!!
Thanks.I think you must be using table control. so no way you can substitute 0 for
missing one. you need to modify query to use right join to include all the
rows.
if you hard code all the months value still you need to change the query to
get all the rows to column..
Try to change query, rather than breaking head.
Amarnath
"CanoAko" wrote:
> I'm working with a data set where some values have an aggretate total
> (for example, a count of something) in a certain date range and others
> do not. The problem I am having is that I need each page of the report
> to show all the possible dates and the display a 0 when there are no
> values for the date. Currently it is dropping that date.
> For Example:
> @.StartDate = 1/1/06
> @.EndDate = 6/31/06
> -- I get this on grouped values where there are empty months:
> Jan06 5
> Feb06 3
> Apr06 7
> Jun06 10
> -- But I want this:
> Jan06 5
> Feb06 3
> Mar06 0
> Apr06 7
> May06 0
> Jun06 10
> Due to other report properties and calculations, I can't really modify
> my query to fix this problem. It seems like it should be easy to solve
> but I'm not getting it!!!
> Thanks.
>|||Hmm... that doesn't really help. I admit now that I will probably have
to design a query to do it. The problem is that the query joins 2
tables and the date that I'm pulling is on the second table. So the
date doesn't exist to do an aggregate with a total of 0 in the first
place.
I'm going to try it with CASE to force it to happen, but I'm not too
excited about that. I've only been doing this for a month so I still
haven't figured everything out.
Amarnath wrote:
> I think you must be using table control. so no way you can substitute 0 for
> missing one. you need to modify query to use right join to include all the
> rows.
> if you hard code all the months value still you need to change the query to
> get all the rows to column..
> Try to change query, rather than breaking head.
> Amarnath
>
> "CanoAko" wrote:
> > I'm working with a data set where some values have an aggretate total
> > (for example, a count of something) in a certain date range and others
> > do not. The problem I am having is that I need each page of the report
> > to show all the possible dates and the display a 0 when there are no
> > values for the date. Currently it is dropping that date.
> >
> > For Example:
> >
> > @.StartDate = 1/1/06
> > @.EndDate = 6/31/06
> >
> > -- I get this on grouped values where there are empty months:
> > Jan06 5
> > Feb06 3
> > Apr06 7
> > Jun06 10
> >
> > -- But I want this:
> > Jan06 5
> > Feb06 3
> > Mar06 0
> > Apr06 7
> > May06 0
> > Jun06 10
> >
> > Due to other report properties and calculations, I can't really modify
> > my query to fix this problem. It seems like it should be easy to solve
> > but I'm not getting it!!!
> >
> > Thanks.
> >
> >|||Hi,
thats quite easy, use the following link to see how to generate a
calendar table, you can either persits it or create it on the fly.
http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html
HTH, Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--

Sunday, February 19, 2012

How do I display info on the report parameters on the face of the report ?

I have several parameters used to constrain which data to select from the database.
Examples of prompts for these parameters ;
"Include accesstype:"
"Include activationdate:"
"Include speed data:"
The user chooses Yes or No to each of these.

On the face on the report I want to put some textboxes to display all the parameters with the prompt (as stated above) and the actual value chosen by the user (Y/N). For clarity, I'm not talking about the report parameter area, but about what you will see on a report print-out.

However, working with a parameter in the expression editor, I can only select members Value, Label, Count and IsMultivalue. I would have expected to be able to select "Prompt", but that is not a member of ReportObjectModel.Parameter.

Anyone have a clue ?

BTW - has anyone been able to display a single checkbox for this kind of paramteres ? (Y/N or True/False. A boolean parameter displays as 2 radiobuttons, labelled True and False)

Thanks !

Parameters!ParameterName.Label should give you the value the user selected.

-Geoff

|||

As I stated in my post, I'm aware of the "Label" member. However I want to access the text I wrote in the report parameter form, in the field labelled "Prompt" (in the opper right part of the form) , not the field labelled "Label" (in the "Available values" part of the form) as you suggest .

Consider that there are in fact 3 elements in play for a parameter displayed with a dropdownlist, namely the text which precedes the dropdownlist (this is the one I want to access), the labels displayed in the dropdown and the corresponding values.

Wally :-)

How do I display info on the report parameters on the face of the report ?

I have several parameters used to constrain which data to select from the database.
Examples of prompts for these parameters ;
"Include accesstype:"
"Include activationdate:"
"Include speed data:"
The user chooses Yes or No to each of these.

On the face on the report I want to put some textboxes to display all the parameters with the prompt (as stated above) and the actual value chosen by the user (Y/N). For clarity, I'm not talking about the report parameter area, but about what you will see on a report print-out.

However, working with a parameter in the expression editor, I can only select members Value, Label, Count and IsMultivalue. I would have expected to be able to select "Prompt", but that is not a member of ReportObjectModel.Parameter.

Anyone have a clue ?

BTW - has anyone been able to display a single checkbox for this kind of paramteres ? (Y/N or True/False. A boolean parameter displays as 2 radiobuttons, labelled True and False)

Thanks !

Parameters!ParameterName.Label should give you the value the user selected.

-Geoff

|||

As I stated in my post, I'm aware of the "Label" member. However I want to access the text I wrote in the report parameter form, in the field labelled "Prompt" (in the opper right part of the form) , not the field labelled "Label" (in the "Available values" part of the form) as you suggest .

Consider that there are in fact 3 elements in play for a parameter displayed with a dropdownlist, namely the text which precedes the dropdownlist (this is the one I want to access), the labels displayed in the dropdown and the corresponding values.

Wally :-)