EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB9726: Reports drop records when two temp tables join on a column with null values


Community Admin

• Strategy


SYMPTOM:
Two temp tables are created as follows:
Temptable1
 

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412


Temptable2
 

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412

Datetime, Date or Time depending on data
Project_idStart_dateEnd_dateWJXBFS1A01/01/200301/01/200412100B01/02/2003 13010C01/03/200301/03/200412020Project_idStart_dateEnd_dateWJSBFS1A01/01/200301/01/200424B01/02/2003 35C01/03/200301/03/200412


The final pass of the SQL appears as follows:
Select pa1.Project_id Project_id,
pa1.Start_id Start_id,
pa1.End_id End_id,
pa1.WJSBFS1 WJSBFS1,
pa2.WJSBFS1 WJSBFS2
From Temptable1 pa1
Left outer join Temptable2 pa2
On pa1.Project_id = pa2.Project_id and
pa1.Start_id = pa2.Start_id and
pa1.End_id = pa2.End_id
The report returns the following:

ka04W000000ObxnQAC_0EM440000002FyI.gif

Notice in the screen shot above that the Data for Project B is missing.
 
CAUSE:
In the example above, the final pass compares End_id of Temptable1 and End_id of Temptable2. If two columns both have null values, those columns are not recognized as "Equal".
 
The Strategy SQL Generation Engine does not support null values in attribute ID columns. Using End_Date as in attribute ID form is incorrect modeling for the Strategy SQL Generation Engine.
 
WORKAROUND:
For the 'End date' attribute, create two forms, ID and DESC. The ID form is that which the Strategy Engine uses to perform the joins, and the DESC form will be what is actually displayed on the report.
 
The following steps demonstrate how two null values can be compared:
 

  • Open the 'End date' attribute editor, as shown below:
ka04W000000ObxnQAC_0EM440000002FyK.gif
  • Modify the ID form definition to the following:
    ApplySimple('NVL(#0, 0)', )
  • NOTE:
    The above syntax is Oracle specific and this function replaces null fields with zeros. This function syntax, however, may be altered to replace Zero by any value. Ensure that single quotes are placed around the text:
     
ka04W000000ObxnQAC_0EM440000002FyM.gif
  • Create a new form called DESC, which may be defined as:
     
ka04W000000ObxnQAC_0EM440000002FyL.gif
  • Set the Report Display form to DESC in the Display tab, as shown below:
ka04W000000ObxnQAC_0EM440000002FyN.gif
  • Save the attribute and update the Schema.


Now, the joins will occur as desired, but the report display will show empty cells for the Null Close Dates, as illustrated below:
 

ka04W000000ObxnQAC_0EM440000002FyJ.gif

 


Comment

0 comments

Details

Knowledge Article

Published:

May 31, 2017

Last Updated:

May 31, 2017