I have a content type with an integer field. The integer has a prefix of $.

The fields display correctly in my view but the calc row (which totals them) does not display the prefix.

There are hacky ways to fix this but it would be ideal if the module respects field prefix/suffix.

Thanks !

Comments

KarenS’s picture

Category:bug» feature

This sounds easy but is not. We can't run an arbitrary value through the formatter that adds these things. I'll make this a feature request in case some one can figure out a way to make it work and provide a patch. But I couldn't see a way to do it.

_paul_meta’s picture

Understandable. As an alternative, is there any chance to set a custom prefix / suffix for each calc field ?

KarenS’s picture

That's probably the only way this can work. Do you want to supply a patch?

_paul_meta’s picture

Unfortunately i am not a sufficiently experienced drupal developer to make such a patch.

quickly’s picture

I am having a similar issue.... my integer field has % sign at its end... views calc does not perform aggregation on it at all..

dunix’s picture

Status:Active» Needs review
StatusFileSize
new3.33 KB

This patch allows for setting a custom prefix/suffix for each column that has a calc field.

kietnguyen’s picture

Thank to dunix for the patch. It works but instead of respecting to the fields' prefixes and suffixes, you have to set the prefix and suffix for each column in Settings of Views Calc Table.

Exploratus’s picture

Thanks. Works great!

j.johnson.bbt’s picture

Works great. Anyway to add a field for moving the decimal also?

When working with prices, it automatically moves the decimal over 2 so 10000 becomes $100.00 etc.

Then when I run it through the table, the output changes it back to 10000. If I put the dollar sign in front, I'm still stuck with $10000.

Morasta’s picture

Issue summary:View changes
StatusFileSize
new3.19 KB

#6 patch worked for me but wouldn't apply to the latest dev update (2014-Mar-25). I have attached an updated patch that works with that dev version.

Morasta’s picture

StatusFileSize
new4.09 KB

Newer patch from #10 that fixes some warnings from the previous one.