CMS Development

GiantVoices
Participante | Parceiro
Participante | Parceiro

Calculation Property Doesn't Work if a Property is Blank

resolver

Hello, 

 

Currently, we have the enterprise level HubSpot account and have been working on creating calculation properties to add together transactional pieces. There is a major roadblock with this property as it doesn't allow a calculation formula to run if there is a blank property. Is there any sort of workaround for this problem? 

 

Thanks, 

 

 

KP

4 Solução aceitas
MelindaNelson
Solução
HubSpot Employee
HubSpot Employee

Calculation Property Doesn't Work if a Property is Blank

resolver

Hi all,

 

I tested this with a customer today. Setting the properties included in the calculation property to 0 did work.

 

To configure this, you can:

  • Create the calculated property using two number properties.

Calculation Property.png

  • On the contact record, add 0 for any values that are unknown.

When the value for Number property 2 is blank, the Calculated number property is unknown.

Calculated Property2.png

When the value for Number property 2 is 0, the Calculated number property is calculated.

Calculated Property3.png

 

I hope this helps! Please let me know if you have any questions! 

 

Thanks,

Melinda | (She/Her)

Customer Support Specialist

Exibir solução no post original

JoshBarber
Solução
Colaborador(a) | Parceiro Diamante
Colaborador(a) | Parceiro Diamante

Calculation Property Doesn't Work if a Property is Blank

resolver

In case anyone stumbles upon this like I did - I also couldn't get this to work and instead used workflows to set the default property to 0.

Exibir solução no post original

hub_muc
Solução
Participante | Parceiro Platinum
Participante | Parceiro Platinum

Calculation Property Doesn't Work if a Property is Blank

resolver

Alternative solution without using a workflow: Use Advanced Mode in the Calculation Property and combine if and is_present function before adding the properties:

(if(is_present([properties.xy]), [properties.xy], 0) +

Exibir solução no post original

Clare_HS
Solução
Participante

Calculation Property Doesn't Work if a Property is Blank

resolver

I couldn't use `is_present` for some reason. I wound up setting the unknown values to 0 within the formaul like:

 

if(is_known([properties.abc]),[properties.abc], 0) + if(is_known([properties.xyz]),[properties.xyz], 0)

 

So we're saying that if the NUMBER property has a value, use that vlaue in the calculation. If there's no value, call it 0 and calculate accordingly. 

That worked like a charm for me after a little trial and error 😀

Exibir solução no post original

29 Respostas 29
MFrankJohnson
Autoridade no assunto

Calculation Property Doesn't Work if a Property is Blank

resolver

Just want to add a workflow to make sure that all blank properties used in calcuated property formulas are auto-updated to zero as new contacts/objects are added to the CRM. 🙂

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
0 Avaliação positiva
huentt
Membro

Calculation Property Doesn't Work if a Property is Blank

resolver

I also encountered the same case
I think Hubspot should add one condition when setting up fields with the following numeric format: if the field has no value, there are two options for users to choose to be blank or zero.
so the calculated fields will work

SteveES
Participante

Calculation Property Doesn't Work if a Property is Blank

resolver

Any updates on this? I just ran into the same challenge and I'm hoping someone has a work around.  Thanks.

GiantVoices
Participante | Parceiro
Participante | Parceiro

Calculation Property Doesn't Work if a Property is Blank

resolver

Hello Steve, 

 

Unfortunately, I've reached out to many HubSpot Support team members and they were unable to provide an acceptable solution. 

 

It's disappointing. However, my team is continually testing within the platform and will let you know if we can find an acceptable solution.

TheoB
Participante

Calculation Property Doesn't Work if a Property is Blank

resolver

I agree with this entirely - except, I'd add another bigger issue. 


The proposed solution of setting the input properties to 0 if blank doesn't work. 

 

It seems that calculated properties treat "0" and "unknown" as the same thing. This is crazy for a tool that is supposed to allow you to add and multiply values - sometimes it's important that you can add "0". 

 

Case in point - we use calculated properties to track costs relating to a project. Our costs are input in various categories. We use a calculated property to add these up.

 

The issue - We dont always have costs in all the categories, so naturally we input "0". 

 

The consequence of this is that the calculated property "total costs" does not add up! 

 

If there's a reason for this I dont understand it? 

 

Why not give us some control over this? 

 

E.G.

- Calculate if any of the input values are known

- Calculate if all of the input values are known

- Treat unknown numbers as "0" or some other integer?

 

Etc?

 

 

Stephanie-OG
Conselheiro(a) de destaque

Calculation Property Doesn't Work if a Property is Blank

resolver

Hi KP, 

 

I've ran into similar issues (mostly with IE not handling calc well in some cases) and what I did was add a first "default" declaration in the CSS with the calc afterwards. If the calc isn't working it should apply the previous CSS declaration. Like:

 

.your-selector {
  height: 100px;
  height: calc( {{ value }} * 3 );
}

If the calc height value isn't working it should default to 100px above.

 

In my case it's getting the opacity from the colour picker:

 

    .sog_team-member .sog_team-member-content {
      background: linear-gradient(
        rgba({{ module.default_image_overlay_colour_1.color|convert_rgb }}, 0.6), 
        rgba({{ module.default_image_overlay_colour_2.color|convert_rgb }}, 0.6)  
      ); /* IE has trouble with nested calculations - defaulting to 0.6 */
      background: linear-gradient(
        rgba({{ module.default_image_overlay_colour_1.color|convert_rgb }}, calc({{ module.default_image_overlay_colour_1.opacity }} / 100)), 
        rgba({{ module.default_image_overlay_colour_2.color|convert_rgb }}, calc({{ module.default_image_overlay_colour_2.opacity }} / 100))  
      );
    }

In the first "background" above it uses an rgba value with an opacity of 0.6 and in the second it calculates that opacity based on what the user selected in the colour picker.

 

I hope that helps!

 


Stephanie O'Gay Garcia

HubSpot Design / Development

Website | Contact

 

If this helped, please mark it as the solution to your question, thanks!

GiantVoices
Participante | Parceiro
Participante | Parceiro

Calculation Property Doesn't Work if a Property is Blank

resolver

Hello Stephanie, 

 

Although this a great solution, I don't believe it solves the issue with the "Calculation" property and the inability to complete the equation if there is a blank property. Below is one of the more basic equations we're looking to compute across all companies.

Screen Shot 2019-02-06 at 8.31.08 AM.png

 

Please let me know your thoughts. 

 

Thank you, 

 

KP 

0 Avaliação positiva
Stephanie-OG
Conselheiro(a) de destaque

Calculation Property Doesn't Work if a Property is Blank

resolver

Apologies, I spend a lot of time stuck in CMS and was thinking of the CSS calc() function. 

 

To solve the problem with your calculation property, perhaps you can use a Workflow to set a value of 0 (or some other default) if the property is unknown?

 

I think @MFrankJohnson or @bradmin use the CRM more than myself and might have a better solution.

 


Stephanie O'Gay Garcia

HubSpot Design / Development

Website | Contact

GiantVoices
Participante | Parceiro
Participante | Parceiro

Calculation Property Doesn't Work if a Property is Blank

resolver

No problem, Stephanie!

 

The workflow is a great idea. However, the client does not like the idea as some of their "0" values within their properties does not mean the value as 0 so we are unable to implement that plan of attack. Are there any other options like conditional formatting, etc.? 

 

Thank you, 

 

KP 

0 Avaliação positiva