473,385 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Null value issue

I have a problem where the Approved value (SQL) has a 1,0 or NULL value. I can not figure out how to show the null value when returned for the filtered input.

Expand|Select|Wrap|Line Numbers
  1. <cfset vApproved = 0>
  2. <cfif isDefined("form.cboApproved")>
  3.     <cfif form.cboApproved eq "">
  4.         <cfset vApproved = 0>
  5.     <cfelse>
  6.         <cfset vApproved = #form.cboApproved#>
  7.     </cfif>
  8. <cfelse>
  9.     <cfset vApproved = 0>
  10. </cfif>
  11.  
Expand|Select|Wrap|Line Numbers
  1. <td>
  2. <select name="cboApproved" class="smallFont">
  3. <!---<option value="All">All</option>--->
  4.  <option value="1"
  5.    <cfif isDefined("vApproved")>
  6.     <cfif vApproved eq 1>
  7.     selected
  8.     </cfif>
  9.    </cfif>
  10. >True</option>
  11.   <option value="0"
  12.     <cfif isDefined("vApproved")>
  13.          <cfif vApproved eq 0>
  14.      selected
  15.      </cfif>
  16.    </cfif>
  17. >False</option>
  18.   <option value= "">Need Approval</option>
  19.     </select>
  20. </td>
  21.  
Query pulling the information below.

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="qRecords" datasource="VarRenum_Spaisdata3">
  2.     SELECT
  3.  
  4.         [VR_Machine_Name] as ActivityType
  5.         ,[Activity]
  6.  
  7.         ,[VR_Department_Number]
  8.         ,[FullName]
  9.  
  10.         ,[Approved]
  11.         ,[ApprovedBy]
  12.         ,[ApprovedDate]
  13.  
  14.         ,[Login_Status]
  15.         ,[Login_Date]
  16.         ,[TotalTime]
  17.  
  18.         ,[VR_Machine_Participant_Activity_Login_ID]
  19.         ,[VR_Machine_Participant_Activity_ID]
  20.         ,[VR_Activity_ID]
  21.         ,[VR_Participant_ID]
  22.         ,[VR_Machine_Participant_ID]
  23.         ,[VR_Machine_ID]
  24.  
  25.         ,[TeamMember_Activity]
  26.         ,[Last_LogInOrOut]
  27.         ,[Logout_Date]
  28.         ,[Inactive]
  29.         ,[InactiveDate]
  30.         ,[InactivatedBy]
  31.         ,[RecCreatedBy]
  32.         ,[RecCreatedDate]
  33.         ,[RecUpdatedBy]
  34.         ,[RecUpdatedDate]
  35.         ,[Method]
  36.         ,[Manning_Factor]
  37.         ,[Approval_Required]
  38.         ,[Batch_Approval_Allowed]
  39.         ,[Batch_LogoutByBUL]
  40.         ,Department
  41.         ,BusinessUnit
  42.         ,Crew
  43.         ,Value_Nvarchar
  44.     FROM [VariableRemuneration].[dbo].[vw_web_Machine_Participant_Activity_Logins] ma
  45.     WHERE
  46.         ma.Approved = '#variables.vApproved#' and
  47.         ISNULL(ma.Approval_Required,0) = '#variables.vApprovalRequired#'
  48.         and ma.BusinessUnit like '#variables.vBusUnit#'
  49.         <!---AND Login_Date Between '#vBeginDate#' AND '#vEndDate#'--->
  50.         <!---AND Login_Status = '#vLoginStatus#'--->
  51.         <!---AND ma.Login_Status = 'In'--->
  52.     ORDER BY ma.Login_Date
  53. </cfquery>
  54.  
Dec 14 '10 #1
2 3109
I need some help getting syntax on an issue. I have a listbox with 3 values, True(1), False(0) and Needs Approval(NULL) but I can't seem to get the NULL to show. The SQL column has this as a bit value so a Case adjustment does not work.

What I need this to do is if the Needs Approval value is selected in the cboApproved box then use the 'qRecordsNull" query to get the results, else use the "qRecords" query.

Below is the code that I have that works for true and false. Any help would be greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. <cfset vApproved = 0>
  2. <cfif isDefined("form.cboApproved")>
  3.     <cfif form.cboApproved eq "">
  4.         <cfset vApproved = 0>
  5.     <cfelse>
  6.         <cfset vApproved = #form.cboApproved#>
  7.     </cfif>
  8. <cfelse>
  9.     <cfset vApproved = 0>
  10. </cfif> 
Expand|Select|Wrap|Line Numbers
  1. <td>
  2.                             <select name="cboApproved" class="smallFont">
  3.                                 <!---<option value="All">All</option>--->
  4.                                    <option value="1"
  5.                                     <cfif isDefined("vApproved")>
  6.                                         <cfif vApproved eq 1>
  7.                                           selected
  8.                                         </cfif>
  9.                                     </cfif>
  10.                                 >True</option>
  11.                                    <option value="0"
  12.                                     <cfif isDefined("vApproved")>
  13.                                         <cfif vApproved eq 0>
  14.                                           selected
  15.                                         </cfif>
  16.                                     </cfif>
  17.                                 >False</option>
  18.                                    <option value= "">Need Approval</option>
  19.                             </select>
  20.                         </td> 
Dec 15 '10 #2
acoder
16,027 Expert Mod 8TB
You could have it as -1 and then check for that within the output of the select element to show the selected option.
Dec 16 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: John Morgan | last post by:
In an SQL statement which concatenates several fields I get a null value returned if any one of the fields are null. Is this to be expected? For example : SELECT tblMember.memberAddress + '...
1
by: Denzil | last post by:
Hi, I am retrieving my DB values and setting them in the MyRS::DoFieldExchange(CFieldExchange* pFX) function. One of these records is a Long datatype and could be "Null" in the DB table. The...
3
by: Robb Gilmore | last post by:
Hello, We have a C#.NET app which is calling a Java webservice. We use the wsdl file exportted from the java webservice to create our web-reference in Visual Studio. We are able to create the...
3
by: Robert | last post by:
I need to be able to send a null value into a Sql Server datetime field. The follolwing code is a snippet of what I am using. I am parsing a flat file from the main frame and inserting it into a...
15
by: TC | last post by:
What does it mean for an integer to have a null value? I am trying to use the DataView.Find method. That method has an integer return type which contains the "index of the row in the DataView...
0
by: hardieca | last post by:
Hi, My formview or gridview control stops updating or deleting a record once the record has a null value. I have table tblTest with the following pkID int NOT NULL **IDENTITY COLUMN**...
4
by: benjen | last post by:
Hi all, XP, office 2003 Pro, MS access. Fairly newby. I'd like to run simple calculations on multiple and specific colums like avg and sd. The problem is that the empty cells cause the ...
1
vikas251074
by: vikas251074 | last post by:
When the page loads default date is displayed in both date field. Can I set null value in expected return date just after selecting 'NR' Not returnable in list? Is there any idea? ...
5
by: axapta | last post by:
Hi Group, How can I overcome the issue of null values in a datareader. I keep getting the dbnull error when I try to assign a null value to a text box. TIA
0
by: meridianPhone | last post by:
Microsoft Access 2007 No forms are involved. I am trying to enforce referential integrity between two tables, but only if there is a non-null value in one of the foreign fields of a compound...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.