Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Fill zeros left
dcbsant
<p>Hi,</p>
<p> </p>
<p>I need to fill with Zeros one part of a string.</p>
<p> </p>
<p>Here the example:</p>
<p> </p>
<p>What I need:</p>
<ul><li>(02) 0 8470006 61187 1 (37) <span style="color:#ff0000;">00</span><span style="color:rgb(255,0,0);">2800 </span>(10) LOT1</li>
<li>(02) 0 8470006 61187 1 (37) <span style="color:rgb(255,0,0);">00</span><span style="color:rgb(255,0,0);">0500 </span>(10) LOT1</li>
</ul><p> </p>
<p>What i Have with my expresion:</p>
<ul><li>(02) 0 8470006 61187 1 (37) <span style="color:#ff0000;">2800 </span>(10) LOT1</li>
<li>(02) 0 8470006 61187 1 (37) <span style="color:rgb(255,0,0);">500</span>(10) LOT1</li>
</ul><p>My expression:</p>
<p> </p>
<ul><li>"(02) 0 " + dataSetRow["LINEAS::RefNum(EanProductNumber)"].substring(0,7) + " " + dataSetRow["LINEAS::RefNum(EanProductNumber)"].substring(7,12) + " " + dataSetRow["LINEAS::RefNum(EanProductNumber)"].substring(12,13) + " (37) " + <span style="color:#ff0000;">dataSetRow["LINEAS::QuantityValue"]</span> + " (10) "+ dataSetRow["LINEAS::RefNum(ItemDescription)"]</li>
</ul><p> </p>
<p>The values of the field are: 2800 and 500</p>
<p> </p>
<p>I dont know hot to fill this part with zeros (max. 6): <span style="color:rgb(255,0,0);">dataSetRow["LINEAS::QuantityValue"]</span></p>
<p> </p>
<p>Thank you very much for your help.</p>
Find more posts tagged with
Comments
wwilliams
<p>Maybe something like this (didn't try it)</p>
<p> </p>
<p>lpad(<span style="color:rgb(255,0,0);">dataSetRow["LINEAS::QuantityValue"]</span>, Math.ceil(<span style="color:rgb(255,0,0);">dataSetRow["LINEAS::QuantityValue"]</span>/2));</p>
<p> </p>
<p> </p>
<p>function lpad(number, length) {<br>
var str = '' + number;<br>
while (str.length < length) {<br>
str = '0' + str;<br>
}<br>
return str;<br>
}</p>