Delete unwanted text from a textbox
Hii, I have an alphanumeric text coming from database as “ABC0000000000000123” into a textbox and I just want to show as “ABC123” in my report (basically, I should eliminate all zeros). How should I handle this? Is there any expression for this or modify my qry? Please help me. Thanks, Sandy
February 8th, 2011 6:59pm

Use an Expression in your text box. Something along the lines of =Fields!SomeFieldName.Value.ToString().Replace("0","") If you truly want to remove ALL zeroes. If you want only to remove consequtive, embedded (i.e. not leading or trailing) zeroes, then you'll have to do a bit more work. Basically, you can write any valid VB.Net expression for your text box, you can also define custom code (function) in your report, or you can load an assembly containing custom code (although these are a pain to use due to GAC and strong-name requirements of SSRS). -cd Mark the best replies as answers!
Free Windows Admin Tool Kit Click here and download it now
February 8th, 2011 8:50pm

But what if there is something like ABC00000001200? In this case I should be able to see ABC1200...
February 8th, 2011 10:09pm

If the length of alpha charactes is fixed to three characters (like you have 'ABC', then you can write the expression like beow. If not, i guess it may require a bit of custom code. =Fields!SomeFieldName.Value.ToString.substring(0,3) & val(Fields!SomeFieldName.Value.ToString.Substring(3)).ToString The val function is quite handly in removing the preceding zeros. Please let us know if this helps. Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH
Free Windows Admin Tool Kit Click here and download it now
February 8th, 2011 11:28pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics