Issue 7190 - recognize units automatically if already there as text if user selects "##unit" mask
Summary: recognize units automatically if already there as text if user selects "##uni...
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.1
Hardware: All All
: P5 (lowest) Trivial (vote)
Target Milestone: ---
Assignee: falko.tesch
QA Contact: issues@sc
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-22 18:00 UTC by lars
Modified: 2003-10-17 08:00 UTC (History)
1 user (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description lars 2002-08-22 18:00:50 UTC
if the cell already contains "number + unit", specifying a custom 
mask "## unit" doesn't "do what one would like", because the cell 
content (was)is text and there is no single number fitting "## unit"; 
the undelying mask is "## unit" already though. So removing 
the "text" 'unit' makes the remaining part be number only and the 
mask is applied showing up as "number unit" in a number mask.

It will be better if there is automatic recognition of such text 
transforming it to "number unit" if unit specified in custom number 
mask matches the unit text in cell content
Comment 1 frank 2002-11-28 15:53:38 UTC
Hi Falko,

1 4 u

I think this is close to Issue 5658

Frank
Comment 2 falko.tesch 2003-10-13 13:56:18 UTC
.
Comment 3 falko.tesch 2003-10-15 14:45:29 UTC
And how shall we know if 1.0 cm is the same as 1.00 cm ???
There is no failsafe automatismn for what you want ands we already
have enough people complaining about our AutoCorretion to be too
caretaking.
Comment 4 falko.tesch 2003-10-15 14:47:24 UTC
closed
Comment 5 lars 2003-10-15 18:13:57 UTC
"traditionalMask customUnit"

the question is where to draw the line: which part belongs to the 
traditional mask and which part is the custom unit.

using "##.# °C" the °C in 10.1 °C becomes the unit but not in 9.4 °C 
if you use # as the indication for the number of places.

This is useful when working with CSV data which sometimes comes in 
the format "data unit" and I don't know an easy way of how to tell 
Calc that it should only calculate with "data" as number.


Regarding your problem: Identify the custom unit (custom text) in a 
user created mask, then look for (multiple) occurences of this mask 
in a cell if mask is to be applied on this cell. Then check whether 
all sourrounding data fits the traditional mask. The first 
surrounding data which fits is taken as the number, the rest is the 
unit. When starting from the right hand side for rhs placed units (I 
don't know whether others are possible), this should be possible.
Comment 6 falko.tesch 2003-10-16 11:23:12 UTC
No I lost you completely!
If you define, lets say #,## °C as a user-defined number format and
assign it to already existing cell content (such as 1, 2, 3 etc) is
will change the content accorsing to the number format.
So AFAIKSI it work fine.
Comment 7 lars 2003-10-16 17:25:25 UTC
the original problem was:

cell A1 contains "4 °C" (without quotation marks) and the cell format 
is text (due to it being a CSV import), which means I can't eg. 
assign =A1*5 to A2 and get 20 °C in A2.

If I choose the cell format # (number) for A1, either I loose the °C 
or the value becomes sth. weird based on the texts internal number 
representation -- I can't remember.

So I want to assign the cell fomat "# °C". But this results in "4 °C °
C" I think (so adding a °C to the already existing 4 °C in A1). In 
order to prevent this double unit °C and in order to be able to 
calculate with the number data 4, I like to have units which are part 
of a cell format recognized automatically in cells the format is 
applied on if the units are already present.
In order to solve this problem, see my last comment.
Comment 8 falko.tesch 2003-10-17 08:00:32 UTC
Final answer:
If you have a cell with 
1 °C
in it, and you want to be able to treat it like a number you vcan
calculate with you must assign a user defined number format like
# "°C"
That's all.
But of course if you INITIAL number format is already text (like
inserting a plain 1 °C) than Calc cannot change this string back into
a number, even not with the above method.
We will not enhance or alter this feature.
Comment 9 falko.tesch 2003-10-17 08:00:56 UTC
Closed.