How to configure List field to save and show 01 rather than 1 ???


Userlevel 3
Badge +16

Hi,

 

Quick question.

 

Got a smartobject field set as number, then have an editable list which can be edited.

 

In this field, i need to store the numbers as 2 digits if less than 10, so for example 01 or 04, but it removes the leading zero, any styles or other ways to ensure it is stored as 2 digits so that i can use it in a rule.

 

Must be 04 not 4

 

Thanks


4 replies

Good day


 


I have searched our documentation and i came across a link that helps with the above raised concern.


You need to create/Using an inline function that will convert you whole(integar) number to a decimal.This will result in having to digits instead of one as stated in your matter.


 


please see the link and the added screenshot,hope it helps or leads you to the right direction in solving the issue:


https://help.k2.com/onlinehelp/k2smartforms/userguide/4.7/default.htm#Build/Workflows/ContextBrowser_Using_Inline_Functions.htm   


 


After the link has opened, collapse/expand the conversion tree-like.


K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.


 

Userlevel 3
Badge +16
Hi,
Thanks for the reply.
I don't need a decimal, must be two digits but any numbers under 10 must be in the format 03 or 05 for example.

I supposed i could just use text instead, but will encounter format issues when doing rules in the workflow
Badge +9

Hi Sharpharp1,

  • Create an expression to check if number is less then 10 then add 0 at starting of it else return same number

 

  • In listview convert  Datafield in view Item area to DataLabel using change control (here first convert datafield to label and the to DataLabel),
  • Now for thisDataLabel  in properties under general for expression select above created expression.
  • You can also use same expression inside rules.

 

Thanks,

Kran

Blog  k2recipes

Badge +4

You can use the Expression on the list view field and 'pad left' with 0 using expression. 

Reply