Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Decimal metafield using MetaFieldBuilder

Vote:
 

Hi,

I'm trying to add a metafield to the cls_organization table, by using the MetaFieldBuilder. Now, creating most of the fields works fine, however, I am not able to create a decimal with a specific precision and scale. When I use the CreateDecimal method, a float is created, which is not what I want.

If I add en entry in the [mcmd_MetaFieldType], with name "Decimal" and MCDataType 18, and use the CreateMetaField method instead where I specify "Decimal" as the typeName and pass an AttributeCollection with specific Precision and Scale, it works fine.

What I am wondering is, is this a safe way to achieve the decimal column in the database?

Best regards
Jessica

#203077
Apr 09, 2019 8:22
Vote:
 

Hi Jessica,

From your description, I found that it's incorrect in CreateDecimal() method from MetaFieldBuilder class that creates the float instead of decimal. I'll create a bug for this.

About the CreateMetaField() method, I think there is no risk when using it to replace for CreateDecimal() method, but note to add precision and scale attributes for AttributeCollection.

Best regards,

GiangTran.

#203104
Apr 09, 2019 12:36
Vote:
 

Hi Giang

Yeah, I did look into the code for CreateDecimal and it looked a bit strange. The question is, if we add "Decimal" by ourselves in the [mcmd_MetaFieldType], could there be a conflict with a future bug fix/update from Epi Commerce?

Thanks!

Best regards

Jessica

#203166
Apr 10, 2019 7:54
Vote:
 

Hi Jessica,

The bug has created.

I'm not sure if there's a conflict from the fix/update with your implementation, it's depend on how we're going to fix. But I think it's may be no.

I'll update some information about the bug when we're resolve it.

Best regards

GiangTran

#203169
Apr 10, 2019 8:30
Vote:
 

Has this bug been filed? If so what's its bug number? And has it been fix in a release?

Thanks,

#207616
Sep 26, 2019 19:29
Quan Mai - Sep 27, 2019 9:53
The bug fix was released in Commerce 13.2.
Matt V - Sep 27, 2019 15:15
Thanks Quan
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.