Solved

Leading Zeros removed when setting single line of text column to calculated value

  • 26 January 2022
  • 7 replies
  • 364 views

Badge +2

I have a responsive form in SharePoint 2019.  There is a calculated value for Cost Center that contains a leading zero (Name: CostCenterCalc Title: Home Cost Center).  There is another field that is a Single Line of Text (Name: HomeCCText Title Home Cost Center Text) that has a rule that sets the value to the calculated  value but the leading zero is stripped.   How do I ensure the leading zero is preserved when set the single line of text column?

21519i483A8C38C4AC2F01.png

 

21518i9C21472455454293.png

Thank you in advance for your help!

Susan

 

icon

Best answer by Aleximo 28 January 2022, 09:05

View original

7 replies

Badge +8

hey @cdpisdg ,


 


u could just connect ur calculated field to the textfield in ur sharepoint list (the textfield doesnt have to be in/on ur form).


 


I didnt know ur formula so i just entered "HomeCostCenter".


 


notice that u have to set "save as data type" to "string":



 

Badge +2
I should explain further.

If you want the formula for the CostCenterCalc calculated value, I'm using if(equals(InactiveEmployee,False),userProfileLookup(Employee,"CostCenter"),""). InactiveEmployee is a y/n control and Employee is a Person/Group control. And it is set to return String.

I know I've only mentioned using it to set HomeCCText but I'm also using it in a Single Line of Text in a repeating section where it were I really need it. I have the repeating section column getting set using HomeCCText. Of course, I can't connect the repeating section column for it to function properly. So, ultimately, I need the repeating section column to properly show the Cost Center without stripping the leading zero. I've tried using the userProfileLookup(Employee,"CostCenter") function in the rule to set the repeating section column but the leading zero is stripped.

Badge +8

hey @cdpisdg ,


 


then u might have a look at this post:


 


https://community.nintex.com/t5/Nintex-for-SharePoint-Forum/In-quot-request-form-quot-if-result-is-zero-on-the-first-letter/td-p/27796

Badge +2

Thank you, Aleximo. I appreciate your feedback.


Unfortunately, I had already tried this unsuccessfully. I thought I better try again so here's the results


I tried just adding a 0 to CostCenterCalc in the second field in the screenshot and then I tried adding 0 to another Single Line of Text control using "0" + userProfileLookup(Employee, "CostCenter) and both instances still strip the leading zero.



 


 


I think I better open a support case.

Badge +8

@cdpisdg ,


 


u have to add a non numeric character.


 


if u add a zero its still only numbers so the 0 u added will be trimmed again.


 


but yeah... maybe the support can help^^

Badge +2

Ok, that kind of makes sense.  If support can't help me, your advice provides me with a possible workaround.  Thank you very much for your responses.  I'll update after I finish working with support.

Badge +2

Support flagged the issue as a defect.  They suggested the same workaround as @Aleximo which is to add a non numeric character(s) to the value which is what I plan to do.

Reply