Focal Point
[SOLVED] Trouble with NULLs in drilldowns

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5377089276

October 07, 2014, 05:03 AM
Wep5622
[SOLVED] Trouble with NULLs in drilldowns
We have a bit of pass-thru SQL that can contain NULLs for a field that is used in a drilldown. In the drilldown the field value is converted to a space ('%20'). We don't want that happening.

Is there a setting or something that changes that behaviour such that the field is either left out or contains FOC_NONE?

I can duplicate the issue with this simple bit of code:
SQL ORA PREPARE SQLOUT FOR
SELECT NULL AS value FROM dual;
END

TABLE FILE SQLOUT
PRINT VALUE
ON TABLE SET STYLE *
$
TYPE=DATA, COLUMN=VALUE, FOCEXEC=DRILLDOWN(VALUE=VALUE),$
ENDSTYLE
END


I realise there are several ways to work around the problem, but I'd rather have WebFOCUS do the right thing. After all, a single space might be a valid value different from NULL in the database. I consider what WF does here to be incorrect behaviour.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
October 07, 2014, 09:27 AM
RSquared
Try this code

SQL ORA PREPARE SQLOUT FOR
SELECT NULL AS value FROM dual;
END

TABLE FILE SQLOUT
PRINT VALUE
ON TABLE SET STYLE *
$
TYPE=DATA,
WHEN=VALUE NE '',
COLUMN=VALUE, FOCEXEC=DRILLDOWN(VALUE=VALUE),$
ENDSTYLE
END
/>


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
October 07, 2014, 10:23 AM
Wep5622
I could do that, but that doubles the number of drilldown definitions I have to write; I would need a FOCEXEC+WHEN for both NULL and NOT NULL.

That may seem odd, as drilling down on an empty value is not normally useful. However, in this repro the value drilled down from is only empty because I intentionally kept it simple.

Perhaps a better example would be:
SQL ORA PREPARE SQLOUT FOR
SELECT 'foo' AS foo, NULL AS value FROM dual;
END

TABLE FILE SQLOUT
PRINT FOO VALUE NOPRINT
ON TABLE SET STYLE *
$
TYPE=DATA, COLUMN=FOO, FOCEXEC=DRILLDOWN(FOO=FOO VALUE=VALUE),$
ENDSTYLE
END


In my actual report, I have nearly 30 drilldowns that suffer from this issue. I'd rather not have to double that number.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
October 07, 2014, 10:46 AM
Tony A
A shot in the dark but might be a possibility, use COALESCE?

select coalesce(FIELD,'FOC_NONE') ....

I've not got access to Oracle at the moment so can't check it out.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 07, 2014, 11:21 AM
Wep5622
Yeah, I thought of that too, but somehow that FOC_NONE value didn't seem to make it through to the drilldown - it was still passed as an empty string.

Perhaps I should try that again, I couldn't explain that behaviour so perhaps something else was going wrong there. If I substitute the NULL in my above example with 'FOC_NONE' it does get passed on as the correct drilldown parameter value... That's something to look into tomorrow - we're near the end of the working day here.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
October 07, 2014, 12:16 PM
Tony A
Try using _FOC_NULL instead?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 08, 2014, 11:01 AM
Wep5622
I found why FOC_NONE (or _FOC_NULL for that matter) didn't get passed along - if you add MAX.FIELD into the internal matrix, make sure you also pass MAX.FIELD to the drilldown parameter list instead of just FIELD.

So COALESCE saved the day once again. Thanks.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :