I am trying to bring the SY03900.txtfield onto a SSRS report. I would like to preserve both the line breaks and the tabs that have been entered in GP.
I am using the following to preserve line breaks
(this formula is from a newsletter from Victoria Yudin's Flexible Solutions.)
How can I change this formula to also preserve the tabs (ie when the user inputting the data hits the tab key)?
Thanks for subscribing to our newsletter! We have experimented with various options for tabs, however, have not found anything that works correctly or consistently. :-(
Victoria Yudin - Dynamics GP MVP (2005-2013)
Want to use Crystal Reports or SSRS with Dynamics GP? Check out GP Reports Viewer
Even after reading Victoria's comment, try
Richard L. Whaley Author, Publisher, Consultant
Enhancing your Dynamics Knowledge!
Thanks for the replies.
I have tried the following:
vbTab does not seem to work at all.
3) =replace(replace(Fields!txtfield.Value,chr(13),vbCrLf),chr(9),” “)
2 and 3 work sufficiently in Visual Studio and when exported to Excel and PDF, but in Report Manager the four spaces are reduced to a single space.
I'm not sure, but I’m guessing that HTML treats whitespace differently.
Yes you are correct HTML will reduce multiple spaces to a single space. The code to add a space that will not be trimmed off is: . So in your case to get the spaces you need:
This however will probably print on the Excel and PDF exports.
Thanks for your reply.
Can you please tell me again what is the code to add spaces that will not be trimmed in HTML? To me it looks like you have typed some spaces between quotes, but I already tried this and it gets trimmed. Are they different types of quotes?
In HTML you have to use a non-breaking space which is character code 160. To replace a tab with 4 non-breaking spaces you would use something like this:
=Replace(Fields!txtfield.Value, Convert.ToChar(9), New String(Convert.ToChar(160), 4))
Keep in mind that this may look and act like a space but it's not. As an example, if you insert a non-breaking space between "Bob" and "Smith" you would not be able to find this if you exported to excel and searched for "Bob Smith".
jgv, thanks for posting this. I have been searching for a solution to this for some time.
The following is working for us:
=Replace(Replace(Fields!txtfield.Value,chr(13),vbCrLf),Convert.ToChar(9), New String(Convert.ToChar(160), 4))
Many thanks to everyone for responding.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Use the official Twitter tags:
#MSDYNCOMM | #CONV13