Showing posts with label checkboxes. Show all posts
Showing posts with label checkboxes. Show all posts

Sunday, February 12, 2012

Checkboxes in Reporting Services?

Hi all

Is it possible to have a checkbox as a parameter.. So a user can check a box to include a column or uncheck to hide a column ?

Thanks
Neil

Hello Neil,

I don't believe there is a way to get a checkbox in the parameters section. Would True/False radio buttons work for you? If so, you can use the Boolean type for your parameter.

Hope this helps.

Jarret

|||Hi Jarret,

Yes radio buttons could work... Although I have just made a parameter boolean but it still rendered as a drop down..

Is there anything specifically I need to do to make the parameter a radio button ?

Thanks.
Neil
|||

What version of Reporting Services are you using?

You should be able to set your parameter to Boolean without any available values and it should show radio buttons. Make sure you don't have Multi-value selected either.

Jarret

|||There we go!

Thanks man!!! I was setting an available value.
Thanks so much!!

Neil.
|||

No problem, glad I could help.

Jarret

Checkboxes in Rdl Table

I am looking fo any suggestion how to put a checkbox in a cell in a table on a rdl report. I used the wizard to make a report that has drilldown in it. I want to be able to have a check box in the cell on every row. When I check this box I want a paramater to run a sub report that builds pdfs of information that corresponsed to the data in that rows thats are checked. Any suggestions. I didnt find any tools that add checkboxes to my toolbox on the report builder. I am using vs2005.net C# asp.net

Right Click on the

|||

I am looking to do the exact same thing. Have you had any progress finding the answer?

|||

No I figured out how to do this in a regular ASP page but not a rdl report I have seen it done thought in an example but can find the example on the web. I will let you know if I finf the example.

CheckBoxes and SQL Server

Hello All,

I am tring to find a better why to do this. I store data in the SQL Server about whether a checkbox was checked or not and the users can come back to the page and alter it as needed. This is the code for Inserting the data. It uses Stored Procedures and I will cut out all unessary code.


myCommand.Parameter.Add("@.CheckBox", myConnection);

That Records it and I use this to retrieve it.


while (myDataReader.Read())
{
string strChecked = myDataReader["Test"];
if ( strChecked == "1" )
{
cbxPhysicalExam.Checked = true;
}
else
{
cbxPhysicalExam.Checked = false;
}
}

This work but I would much rather do this...


while (myDataReader.Read())
{
cbxPhysicalExam.Checked = myDataReader["Test"].ToString();
}

Does anyone know how to do this?

Much Thanks,
RogerDepends on the type you're using in the database. Typical, for a boolean value (that's the case for checkboxes) you use the SQL Server type 'bit'. This returns a 0 or 1 value which can be casted to a boolean value.

Hope this helps?|||OK thats what I use... but how do I code it on the return... It will not compile like this...


cbxExample.Checked = myDataReader["Example"];

I get this on attempt to compile...

Cannot implicitly convert type 'object' to 'bool'

OK... maybe I need to Explicitly convert. I do not know how convert 1 - true and 0 - false|||Yes I see, maybe I was not clear enough in my answer. The bit type in the SQL Server is far more efficient to work with when doing queries etc. How to convert 1 to true and 0 to false? You may use something like this:

cbxExample.Checked = myDataReader["Example"].ToString() == "1";

which will do the job.|||I tried that and it didn't work... Here is all the code

SQL SERVER Table - TEST

Columns - ID int - Test bit

Store Proc For Select
CREATE PROCEDURE dbo.sp_Test
AS
Select * From Test
GO

Store Proc For Insert
CREATE PROCEDURE dbo.sp_TestIns (
@.Testbit )
AS
Insert Into Test (
Test
)
Values (
@.Test
)
GO

Code Behind Page


void SaveClicked()
{
SqlCommand myCommand = new SqlCommand("sp_TestIns", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.Add("@.Test", cbxText.Checked);
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();{
}

void Fill()
{
SqlCommand myCommand = new SqlCommand("sp_Test", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
myConnection.Open();
SqlDataReader myDataReader;
myDataReader = myCommand.ExecuteReader();
while (myDataReader.Read())
{
cbxPhysicalExam.Checked = myDataReader["Test"].ToString() == "1";
}
myDataReader.Close();
myConnection.Close();
}

THis doesn't work... what am I doing wrong?|||I figured it out... Thank you for your help...

cbxTest.Checked = (bool)myDataReader["Test"];

Thanks Again...

Roger

checkboxes and exporting to PDF

How do you mange to create checkboxes on your reports?
Since there is no builting support for checkboxes, I have tried using:
Windings font:
=IIf(Fields!MyBooleanField.Value=False,ChrW(&h006F),ChrW(&h00FE))
that would give me the empty square and the ticked square (when previewed
in dhtml). However when exported to PDF, the ticked checkbox is replace by a
not desired different character.
Arial font:
=IIf(Fields!MyBooleanField.Value=False,ChrW(&h2212),ChrW(&h221A))
that would give me ? and -
This is more or less the best thing I have been able to do to mimic the
behaviour of a checkbox. However this is not a checkbox at all, it is just a
square root sign and a minus sign.
I need the report to be rendered into PDF format. I don't mind if the
previewed dhtml version works or not. I just need it to work for the PDF.
Another possibility is to do image captures of checkboxes and show one or
the other depending on value of the variables. I find that solution not very
nice; sure it will work, but I think there must be a smarter solution.
Has someone managed to mimic the behaviour of a checkbox in a report (that
renders fine to PDF)?
Thanks in advance.Hi jagb,
I have the same problem, did you find any solution?
Thanks, Markus
"jagb" wrote:
> How do you mange to create checkboxes on your reports?
> Since there is no builting support for checkboxes, I have tried using:
> Windings font:
> =IIf(Fields!MyBooleanField.Value=False,ChrW(&h006F),ChrW(&h00FE))
> that would give me the empty square and the ticked square (when previewed
> in dhtml). However when exported to PDF, the ticked checkbox is replace by a
> not desired different character.
> Arial font:
> =IIf(Fields!MyBooleanField.Value=False,ChrW(&h2212),ChrW(&h221A))
> that would give me ? and -
> This is more or less the best thing I have been able to do to mimic the
> behaviour of a checkbox. However this is not a checkbox at all, it is just a
> square root sign and a minus sign.
> I need the report to be rendered into PDF format. I don't mind if the
> previewed dhtml version works or not. I just need it to work for the PDF.
> Another possibility is to do image captures of checkboxes and show one or
> the other depending on value of the variables. I find that solution not very
> nice; sure it will work, but I think there must be a smarter solution.
> Has someone managed to mimic the behaviour of a checkbox in a report (that
> renders fine to PDF)?
> Thanks in advance.
>
>

Checkbox with the same name truncates at a space

When I use SQL to populate a checkbox and give the checkboxes all the same name, when I retrieve it a name containing a space is truncated at the space. How can I get the whole name?

<%while NOT rs.EOF%>
<INPUT TYPE=CHECKBOX NAME="code" value=<%=rs("code")%> <%If request.Form("code") = rs("code") then%> CHECKED <%End If%>><%=rs("code")%><br>
<%rs.MoveNext
wend
rs.Close%>

strStatus_code = Request.Form("code")

gives me Active, Inactive, Phase

what I want is gives me Active, Inactive, Phase Out

:confused:This is not a problem with SQL, but with the way you are writing out the values.

Place quotes around the value when you write them out for display, so that when you do a view source from the browser you should see.

"Active"
"Inactive"
"Phase Out"

<%while NOT rs.EOF%>
<INPUT TYPE=CHECKBOX NAME="code" value=" <%=rs("code")%>"
<%If request.Form("code") = rs("code") then%> CHECKED <%End If%>>" <%=rs("code")%>" <br>
<%rs.MoveNext
wend
rs.Close%>|||Worked perfectly!! Thank you.:) :) Suzy

CheckBox in Crystal Reports 8.0

Hi,
Can we add checkboxes in the crystal reports?
Thanks In advanceHi,
I m showing some boolean values on my report but for this i m writing the formulas that if field = 1 then "Yes" but i want to display checkbox if instead of the values yes / no.
Can we add checkboxes in the crystal reports?

Thanks In advance|||Why do you want to use?