Bug 143192 - 'Format' Basic function doesn't handle Null values
Summary: 'Format' Basic function doesn't handle Null values
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-05 06:01 UTC by Mike Kaganski
Modified: 2022-03-26 00:27 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2021-07-05 06:01:25 UTC
Format function's format string takes up to four sections separated by semicolons. The fourth section is for Null values.

This is defined in SbxValue::Format, which handles SbxNULL values explicitly, calling SbxBasicFormater::BasicFormatNull. However, calling

> Format(Null)

or

> Format(Null, ";;;""NNN""")

results in "Inadmissible value or data type. Data type mismatch" error.
This works in VBA [1]: the former call returns "", and the latter returns "NNN".

[1] https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications
Comment 1 Andreas Heinisch 2021-07-07 17:59:32 UTC
Confirmed in:

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 0aea0cee58fe77a9058217dfdfc3d6a02b29ee2a
CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-US
Calc: CL
Comment 2 Paris Oplopoios 2022-03-25 17:17:22 UTC
I am trying to work on tdf#143193. Is Null supposed to be a correct data type? It doesn't seem to recognize it as one.