Convert Line Item Term to a number

Now that we can create calculated Line Item properties, I am trying to create a property that uses the Term in the calculation. However the Term property is a string (eg. P12M) rather than a number. I’ve created a new “Line Item Term in Months” property but does anyone have any suggestions on how to convert the Term into a number? I know how to do it in Excel (using the SUBSTITUTE function) but this isnt available in HubSpot calcualted properties. I tried using the String-to-number function but it doesn’t wok as there are letters in the Term property.

Hi @CAdams21
You can use a workflow to populate the new number property from the string one. You can’t convert a property in HubSpot.
If you need a hands-on solution to any complex issues, feel free to inbox me. If this solves your problem, please mark it as a solution! Cheers!

Thanks Tonmoy. I tried poplating it with a workflow but couldn’t work out how to strip out hte text there either. Do you have any suggestions? Thanks

You don’t have to strip out the texts. I’m assuming that the terms are 1 month, 3 months, 6 months and so on. What you can do is, create another calculation property with the values from the previous property. The calculation would look something like this: If (Property A contains 1, 1), if (Property A contains 2, 2) and so on. This would parse the strings and provide numbers as output, which you can then use for your main property.

Thanks you Tonmoy. That would work although the term could be any number between 1 and 60 (or more) so would be cumbersome. It looks like we can do it using code as we have Operations Hub so I’m gong to explore that. Thanks for your help

Thank you! If you need any further help, feel free to inbox me or post it here.