You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
People need to know the format of the formula result to visulize the result.
Example 1:
DATE(2000, 1, 1) results in
36526 in General format
1/1/2000 in Date format.
Internally, the value is being stored as a number36526 (or so-called excel serial number), but there is a way to store and propagate the type of the value when evaluating the formula DATE(2000, 1, 1). Thus, we can tell users that the result is a Date.
Example 2:
DATE(CONCAT(200, 0), 1, 1) returns a date value/ serial number. CONCAT(200, 0) always return a string (or error), DATE(CONCAT(200, 0), 1, 1) always return a date (or error).
Example 3:
CONCATE(DATE(2000, 1, 1)) returns a string.
Questions
Do we need to propagate the type internally?
It is unnecessary. We only need to know the out-most function name, since the out-most function determines the result type.
How many types are there?
So far, I discovered only Date and General. General can be JavaScript Number, String, Boolean.
How about some formulas returning a cell reference, range reference, array? Should we tell the user what we returning?
How about a simple reference =A1, where A1 has a formula type Date?
We should know the type of the given cell, but how?
Should we provide a format function in the result wrapper, which is basically SSF.format but only takes a format string?
Do we use a pure JS object to wrap the formula result, or a class?
class may use more memory. Generating more unnecessary data → Invoke Garbage Collector more frequently.
More questions?
Proposing
Currently I don't have a clear idea of the implementation, we must think of all the questions above carefully.
Instead of returning the value directly, we return an object that wraps the result and add information about the type, e.g., Date, or Excel Serial Number.
The text was updated successfully, but these errors were encountered:
Why?
People need to know the format of the formula result to visulize the result.
Example 1:
DATE(2000, 1, 1)
results in36526
in General format1/1/2000
in Date format.Internally, the value is being stored as a number
36526
(or so-called excel serial number), but there is a way to store and propagate the type of the value when evaluating the formulaDATE(2000, 1, 1)
. Thus, we can tell users that the result is aDate
.Example 2:
DATE(CONCAT(200, 0), 1, 1)
returns a date value/ serial number.CONCAT(200, 0)
always return a string (or error),DATE(CONCAT(200, 0), 1, 1)
always return a date (or error).Example 3:
CONCATE(DATE(2000, 1, 1))
returns a string.Questions
Do we need to propagate the type internally?
It is unnecessary. We only need to know the out-most function name, since the out-most function determines the result type.
How many types are there?
So far, I discovered only
Date
andGeneral
.General
can be JavaScript Number, String, Boolean.How about some formulas returning a cell reference, range reference, array? Should we tell the user what we returning?
How about a simple reference
=A1
, where A1 has a formula typeDate
?We should know the type of the given cell, but how?
Should we provide a format function in the result wrapper, which is basically
SSF.format
but only takes a format string?Do we use a pure JS object to wrap the formula result, or a
class
?class
may use more memory. Generating more unnecessary data → Invoke Garbage Collector more frequently.More questions?
Proposing
Instead of returning the value directly, we return an object that wraps the result and add information about the type, e.g.,
Date
, orExcel Serial Number
.The text was updated successfully, but these errors were encountered: