English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to know all the possible ways to convert null values to zeros in Textbox controls using Sql Server Reporting Services 2005.
I know I could use isnull(columnName,0) in my T-SQL select statement, but that's ugly. I can also use some function in the Value property turning this: =Fields!TranNo.Value into something like this: =cint(Fields!TranNo.Value). Is there anyway to use the Format property? I don't know much about the .NET code that you can write in a report. Is it only capable of Functions and Subs that get called from field values, or could I code some kind of event handler like in an MS Access report? OnReportLoad kinda thing? If I could do that, could I loop through the rows and columns of the dataset and swap out the nulls for zeros there?
Thank you for your help! I've been trying to figure this out and going crazy!

2007-03-03 08:47:00 · 1 answers · asked by George C 1 in Computers & Internet Programming & Design

1 answers

use javascript in your forms page. using the onsubmit, enumerate every field and set the value if null. The code has some spaces in the document.x. ....yahoo doesn't like certain string groupings and truncates it....you will need to remove the spaces

if document.formname.fieldname = ""
{document. formname. fieldname=0}

You can do some more validation too......assuming you don't want negative numbers.....
if document. formname. fieldname < 0
{//Do something here, maybe a messagebox saying no negative number are allowed
//Change the color
document. formname.fieldname. style. backgroundcolor = "yellow";
//Set focus back on the field
document. formname. fieldname. focus();
//prevent the form from being submitted
return false; }

2007-03-04 15:40:36 · answer #1 · answered by Jeffrey F 6 · 0 0

fedest.com, questions and answers