473,399 Members | 2,146 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,399 software developers and data experts.

Best practice replacing null date in a report with alternate

I have a query that returns all the orders the were closed during a given week, and all the orders that are still open.

Then I have a report based on that query, that lists all the orders by the date. The report looks perfect except for the open orders, which of course do not have a date closed.

So open orders show up as #type! for their date.
For those orders, I would like to replace the closing date, which doesn't exist, with the date the order was opened.

I'm not sure how to deal with this. Do I need a if/then function in my query to replace null closing date, with open date?
Or do I need an expression in the report itself to replace null closing, with the open date?

Or do I need to have a sub-report that uses an open order query which already exists, inside my existing report?

What do more experienced people recommend?
Jul 6 '18 #1

✓ answered by twinnyfo

Phil,

For proper Syntax, IsNull() needs to evaluate just the Date, without additional arguments (and i remived the "Not" for clarity's sake:

Expand|Select|Wrap|Line Numbers
  1. NewClosingDate: IIf(IsNull(ClosingDate), OpenDate, ClosingDate)
Or:

Expand|Select|Wrap|Line Numbers
  1. NewClosingDate: IIf(IsNull(ClosingDate), "", ClosingDate) 
However, Null Dates should not display with #Type; they should simply be blank. If we fix that problem first, then we can choose to display the Open date instead (but I think that would be confusing for anyone reading the report).

5 1236
twinnyfo
3,653 Expert Mod 2GB
Andre77k,

Welcome to Bytes!

Something sounds wrong with your Query itself. If you are including a Date Field, and it happens to be Null, then it will show up as Blank on your Report. Are you trying to manipulate the Date somehow?

It would be helpful to include your query here and we can take a look at it.
Jul 6 '18 #2
PhilOfWalton
1,430 Expert 1GB
In your query you have several options.
Add a new field "NewClosingDate"

Expand|Select|Wrap|Line Numbers
  1. NewClosingDate: Iif Not  IsNull(ClosingDat, ClosingDate, OpenDate)
  2.  
Or to my mind, better still as it will give a blank NewClosingDate
Expand|Select|Wrap|Line Numbers
  1. NewClosingDate: Iif Not  IsNull(ClosingDat, ClosingDate, "")
  2.  
Your report obviously uses the NewClosingDate

Phil
Jul 6 '18 #3
twinnyfo
3,653 Expert Mod 2GB
Phil,

For proper Syntax, IsNull() needs to evaluate just the Date, without additional arguments (and i remived the "Not" for clarity's sake:

Expand|Select|Wrap|Line Numbers
  1. NewClosingDate: IIf(IsNull(ClosingDate), OpenDate, ClosingDate)
Or:

Expand|Select|Wrap|Line Numbers
  1. NewClosingDate: IIf(IsNull(ClosingDate), "", ClosingDate) 
However, Null Dates should not display with #Type; they should simply be blank. If we fix that problem first, then we can choose to display the Open date instead (but I think that would be confusing for anyone reading the report).
Jul 6 '18 #4
That was the answer I was looking for.

Expand|Select|Wrap|Line Numbers
  1. IIf(IsNull([DateOut]),[DateIn],[DateOut]) AS FinDate
This ended up being my exact solution, based on your both of your posts. Thank you.
Jul 6 '18 #5
twinnyfo
3,653 Expert Mod 2GB
I'm glad we could find a solution you can work with.

Did we ever figure out why the dates were displaying so strangely in the Report?
Jul 6 '18 #6

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

Similar topics

1
by: | last post by:
Sql server 7 There will be times when the user will not be required to supply a value for the calling asp script that pass values to an sql server Sp. How can I handle these null or empty...
4
by: Johannes Hansen | last post by:
What are the best practice on handling an exception caused by a Dispose method when its called from inside a loop? Wrap the entire loop in a try-catch or do the try-catch on each iteration to get...
17
by: | last post by:
I have an app that retrieves data from an Access database. At the moment I have the SQL string as a Const in my app. I understand this is not best practice. I don't want the user to have access to...
9
by: Bryan Hepworth | last post by:
Hi Everyone I'm wondering what the best practice is for a particular task I'm trying to accomplish. I'm using two sets of radio buttons for a user to select values from. These values then go...
15
by: Bob Alston | last post by:
Is it considered best practice to distribute FE databases as MDEs rather than MDBs? Without flaming me for asking the question, could someone please enumerate the key advantages? Also I like to...
4
by: =?Utf-8?B?bW9mbGFoZXJ0eQ==?= | last post by:
In VB6, we created a number of ActiveX DLLs that all shared a similar interface. The main application would load these in dynamically (late-bound.) This worked well for our situation because we...
13
by: G | last post by:
Hello, Looking for opinions on a fairly simple task, new to ASP.net (C#) and want to make sure I do this as efficiently as possible. I have a web based form, and I need to run some SQL before...
7
by: Steve | last post by:
I am building an object library for tables in a database. What is the best practice for creating objects like this? For example, say I have the following tables in my database: User: - Id -...
6
by: Peter Larsen [CPH] | last post by:
Hi, I'm looking for some "best practice" help related to web applications and recources (images, strings, files etc). In Windows Forms Applications its normal to save all kinds of resources in...
3
by: fjm | last post by:
I'd be interested in someone looking over this foreach loop to see if there is a better way to do this. These loops gives me exactly what I need but I can't help but think it isn't the best practice...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.