Closed beetleskin closed 6 years ago
@beetleskin the string formatter in combination with actual floats is the correct choice. However, the floats were erroneously cast to strings in the backend already - fixed in 3.1
A dedicated float formatter would require a format string and so far formatters cannot receive parameters. If you want more control you can add your own formatters, see https://ternaris.com/marv-robotics/docs/widgets.html#custom
@beetleskin the string formatter in combination with actual floats is the correct choice. However, the floats were erroneously cast to strings in the backend already - fixed in 3.1
With version 3.1 and the config line as posted initially, I still get the same error. And still: Running marv scan again returns no error .. and the formatter in the listing works correctly.
Despite that, I still don't know how to summarize this kind of float-valued-but-string-formatted listing columns.
In the doc, you list the formatters float and int, but they're nowhere to be found in the FORMATTER_MAP.
@beetleskin The format function you are using returns a string, which cannot be summarized. In 3.1 you have the following options:
'float': float,
to the FORMATTER_MAP it is already available in the frontend. In 3.2 it will be added to the FORMATTER_MAP. The float formatter renders two decimal places.Regarding the error you are describing, a minimal working example would be helpful. To this end we created https://github.com/ternaris/marv-site#reporting-issues--minimal-working-example
The FORMATTER_MAP storing the formatters for the _listingcolumns is very limited and misses basic atomic types. E.g. I just want to display a float and accumulate that float in _listingsummary.
All I can do right now is use the string formatter in the _listingcolumns. When I then accumulate that row, it displays "0" in the _listingsummary when I set the _listingsummary formatter to float. It concatenates the string values of that column if I set it to string, resulting in the summary: "0.334.235.3437.54.4334.45".
I don't get why especially a "float" formatter is missing for _listingcolumns (and filters?), it's one of the most common things to work with. Also, it is not straight forward, why there are different formatters for _listingcolumns and _listingsummary.
Update: Related: When I use the format S-Expression, I get an error on
marv scan
:config:
Running
marv scan
again returns no error .. and the formatter in the listing works correctly.