3
$\begingroup$

I have some imported data that include big numbers, and I don'y want them to be displayed in *10^8 format.

The following code demonstrate the problem:

TableView[{{1, DecimalForm[2.3*10^8]}, {2, DecimalForm[2.55*10^8]}}, 
 ImageSize -> 1200, Editable -> False]

The output is just repeating my input, only DecimalForm[2.3*10^8] and DecimalForm[2.55*10^8] is calculated.

$\endgroup$
1
  • 2
    $\begingroup$ With wrappers the numbers are no longer numbers. For this example you could just use Round: TableView[{{1, 2.3*10^8}, {2, 2.55*10^8}} // Round, ImageSize -> 1200] $\endgroup$
    – Bob Hanlon
    Mar 27, 2020 at 4:09

1 Answer 1

8
$\begingroup$

The literal answer to your question is that controls need to specify what kind of inputs they take. If you look at ref/TableView, you'll see that the default inputs are strings and numbers. DecimalForm[number] is a general expression (just like f[1]), not a number. So you need to add second argument of Expression.

However, there appears to be a bug specific to DecimalForm and related wrappers like NumberForm that causes DecimalForm not to display correctly inside TableView. You see the "raw boxes" instead of the number. I'll file that as a bug, but I guess there's a reason why this is feature is still marked experimental...

Update: the bug mentioned in the last paragraph is known, and there's every reason to believe it will be fixed in time for 12.1.1 (out later this spring).

$\endgroup$
2
  • $\begingroup$ Finally I used Dataset😂 $\endgroup$
    – fairytale
    Mar 27, 2020 at 9:05
  • 3
    $\begingroup$ If you're using it just for display purposes, Dataset is probably better in any event. TableView is really a control, like a slider or checkbox, rather than formatting wrapper. $\endgroup$ Mar 27, 2020 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.