Need help with a Calculated Field Expression | Community
Skip to main content
Level 2
March 13, 2022
Solved

Need help with a Calculated Field Expression

  • March 13, 2022
  • 1 reply
  • 2313 views

I'm trying to create a custom artwork file name based on the name of the project name entered into our system and reference number. Is there a custom expression I can use to remove the spaces in a project name or replace the spaces with an underscore?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ali_Pentico

Hi Sarah. You can use Replace to remove the spaces. The bolded section in the equation below is what I used on a project custom form that will replace spaces with an underscore. The equation would need to change a bit if you are adding the custom field to a different object or if you are just creating a calculated column in a report/view.

CONCAT(Reference Number,REPLACE(Name," ","_"))

The result for a Project A with a reference # of 123 would be: 123Project_A

Hope this helps!

1 reply

Ali_Pentico
Ali_PenticoAccepted solution
Level 2
March 14, 2022

Hi Sarah. You can use Replace to remove the spaces. The bolded section in the equation below is what I used on a project custom form that will replace spaces with an underscore. The equation would need to change a bit if you are adding the custom field to a different object or if you are just creating a calculated column in a report/view.

CONCAT(Reference Number,REPLACE(Name," ","_"))

The result for a Project A with a reference # of 123 would be: 123Project_A

Hope this helps!

Kundanism
Level 10
March 15, 2022

Thanks a lot @Ali Pentico‚ for sharing above expression. But it is possible to restrict until first 10 letters or first two words only. Could you share the expression for similar request? Also, if this creates a clickable link that will be excellent.

Mvh

Kundan.

Ali_Pentico
Level 2
March 15, 2022

Hi Kundan. To get the first 10 characters, I would use the LEFT function. Using LEFT(Name,10) on a Project would give you the first 10 characters of the project name. Below is the text mode I used to create a column in a project report that would show the first 10 characters of the project name and then still link to the project. I bolded the part that does the link.

displayname=Shortened Name

linked.valuefield=name

linked.valueformat=HTML

namekey=name

querysort=name

textmode=true

valueexpression=LEFT({name},10)

valueformat=HTML

Hope this helps.

-Ali