Conditional Calc Fields Throwing Errors


I’m currently adding two calc fields to SummaryBill that rely on two existing fields, so it’s now defined as the following:

consumption: ExactDimension

peakDemand: ExactDimension

consumption_flip: ExactDimension calc " == 'xyz' ? peakDemand : consumption"

peakDemand_flip: ExactDimension calc " == 'xyz' ? null : peakDemand"

I can fetch specific SummaryBills by filtering and get no error (and the calc fields return as expected); however, if I do a SummaryBill.fetch(), I get the following error:

Error: Invalid Dimension: 'value' field in Obj<ExactDimension> [,]↵ at new C3.client.ActionError

Is there anything obviously wrong with these calc fields? If not, how can I further debug to find offending records that are causing this?


This allows me to fetch the SummarBills, but these fields end up always being empty…?

consumption_flip: ExactDimension calc " != 'xyz' ? {value: consumption.value, unit: consumption.unit} : {value: peakDemand.value, unit: peakDemand.unit}"

peakDemand_flip: ExactDimension calc " != 'xyz' ? {value: peakDemand.value, unit: peakDemand.unit} : null"


@sean.summers Where is this happening? Is it something that can be reproduced locally?


@trothwein This is happening in a QA environment. I cannot reproduce locally, which leads me to believe there is an offending SummaryBill record causing the issue.


What’s also odd is that

SummaryBill.evaluate({projection: "unique("})

Returns only ‘xyz’, when I know for a fact I can fetch other SummaryBills where‘abc’


I think I found the culprit…
There exists a record of SummaryBill whose‘jkl’, and it has:

peakDemand: {unit: {id: 'MLBH'}}
consumption: {value: 10, unit: {id: 'MLB'}}

This record that does not have the value field populated on peakDemand causes the error. But value is not a required field on ExactDimension, so I’m not sure why this would be an error…

Yet even with my “fix” the two new fields are not populated at all for this SummaryBill…


@sean.summers I would file a ticket and include your findings.