If expression to pad with zeroes

73
1
07-30-2019 08:57 PM
Highlighted
Occasional Contributor III

Hi,

I have the following expression:

if(${building_num}>0 and ${building_num}<=9, '000','000') or if(${building_num}>9 and ${building_num}<=99,  '00','00') or if(${building_num}>99 and ${building_num}<=999,  '0','0') or if(${building_num}>999 and ${building_num}<=9999,  '','')

When testing in Connect, the result is exactly what I am after (i.e. 0001), however when published, I am getting 'true' as part of the response value (i.e. true1) without my zero padding.

How do I construct the expression so 'true' isn't captured but my zero padding is correct?

Craig

0 Kudos
1 Reply
Highlighted
Occasional Contributor III

Worked it out:

if(${building_num}>0 and ${building_num}<=9, '000', if(${building_num}>9 and ${building_num}<=99,'00', if(${building_num}>99 and ${building_num}<=999, '0', if(${building_num}>999 and ${building_num}<=9999,  '',''))))

0 Kudos