itwinjs-core icon indicating copy to clipboard operation
itwinjs-core copied to clipboard

Unit conversion from SQ_M to SQ_FT fails

Open Rock2000 opened this issue 7 months ago • 2 comments

We have schema properties that use Area units. When the element is selected, the frontend tries to use a quantity formatter to format the stored SQ_M value in SQ_FT. This crashes inside UnitFormatter.processUnits due to:

    if (!this.checkBaseUnitsMatch(fromBaseUnits, toBaseUnits))
        throw new BentleyError(BentleyStatus.ERROR, `Source and target units do not have matching base units`, () => {
            return { from, to };
        });

Image

Image

Rock2000 avatar May 20 '25 19:05 Rock2000

@Rock2000, what's the version of itwinjs-core you're using?

grigasp avatar May 21 '25 04:05 grigasp

@Rock2000 what kind of quantity are you using for these area properties? The persistence unit might be different between these two. The code snippet you share is coming from ecschema-metadata, so this must be the SchemaUnitsProvider logic. Is the schema in question something that can be found in the public bisschemas GH repo?

cc @ColinKerr @rschili

hl662 avatar May 23 '25 15:05 hl662

@Rock2000 is this still an issue?

ColinKerr avatar Aug 08 '25 12:08 ColinKerr

Sorry, I don't get notifications from github (or they are lost in a sea). I think this is all set, although I don't know if we sidestepped it or if it was fixed. But I guess for now we can say it works.

Rock2000 avatar Aug 08 '25 20:08 Rock2000