Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Monday, March 19, 2012

Line feed problem in HTML

I'm using a string in report which contains chr(10) -> Line feed characters. They show up correctly (there are several lines) in Preview screen and in pdf-format but NOT in browser. I think the browser doesn't understand those characters. Is there a way to replace them somehow with other useful keys? If there is an example would be great...

I use the equivalent of the old vbCrLf i.e. carriage return followed by a line feed, and this works fine in the HTML.

Try using Chr(13) & Chr(10) or the .NET property Environment.NewLine.

For formatting in SQL I use CHAR(13) + CHAR(10)

|||I'm sorry but I didn't get it. I have 3 rows long field in report(Fields!Address.value) and that value contains those carriage returns. So should I edit the expression of the field to find where the carriage returns are and replace them somehow?|||try Replace(Fields!Address.Value, chr(10), Environment.NewLine)

Line Feed in Text Box on rdl file

I am triyng to add a line feed char to my DB string which is assigned to a
text box, cant figure out how.
Line One"\n"Line Twotry appending a char(10) at the end of the string.
Ex:
print 'abcd'+char(10)+'efgh'
or
print 'abcd'+char(13)+'efgh'
"Adi" wrote:

> I am triyng to add a line feed char to my DB string which is assigned to a
> text box, cant figure out how.
> Line One"\n"Line Two|||Maybe use both. Most windows apps look for a Carriage Return and a Line
Feed together.
print 'abcd'+char(13)+char(10)+'efgh'
However, is this post even in the right forum? Are you trying to do this in
SQL Server, in VB.Net, Javascript?
"tthrone" <tthrone@.discussions.microsoft.com> wrote in message
news:D577C263-F691-4AE3-B7BD-6219F1F90B94@.microsoft.com...
> try appending a char(10) at the end of the string.
> Ex:
> print 'abcd'+char(10)+'efgh'
> or
> print 'abcd'+char(13)+'efgh'
> "Adi" wrote:
>
a

Line delimiter.

Hi all.

I have some problem. String is kept in format "aaaa\r\nbbbb\r\nc\tcc" in database

When i trying to render a report(RS 2000) i take this result

textbox :

aaaa\r\nbbbb\r\nc\tcc ,but i want

textbox:

aaaa

bbbb

c cc

Can you help me?

You could write a custom renderer on your own (sounds harder than it really is :-) ) Passing the data to managed code and letting the code to produce & vbclrf & for line feeds.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

Hi All

I've found simple way to realize this feature. It turned out, that RS dont understand C# delimiter but understand VB delimiters .

I've written custom code for impleting this thing

Function ConvertString(ByVal value As String) As String
value = value.Replace("\n", vbCr)
value = value.Replace("\r", vbLf)
value = value.Replace("\t", " ")
Return value
End Function

|||

Thats actually what I ment :-D

-Jens.

|||Thanks ;=)

Line Break in T-SQL

Hello,

In a Stored Proc, I am building a string variable. I am getting outputs
from 4 different queries and would like the string to have line breaks
to display each entry in a different line in a text area. How can I do
this?

i.e
result = result1 + result2 + result3 + result4.
What characters can I enter so that the output is displayed in the
textarea as
result1
result2
result3
result4

Thanks,SELECT 'asdfasd'+char(13)+'ASDF ASF ASDF ASD'

maybe it's CHR not CHAR|||The line terminator on a Windows platform is carriage return/line feed
(ASCII 10 and 13). You can concatenate CHAR(13) + CHAR(10) where you want
line breaks.

--
Hope this helps.

Dan Guzman
SQL Server MVP

<nashak@.hotmail.comwrote in message
news:1158285904.128023.10670@.e3g2000cwe.googlegrou ps.com...

Quote:

Originally Posted by

Hello,
>
In a Stored Proc, I am building a string variable. I am getting outputs
from 4 different queries and would like the string to have line breaks
to display each entry in a different line in a text area. How can I do
this?
>
i.e
result = result1 + result2 + result3 + result4.
What characters can I enter so that the output is displayed in the
textarea as
result1
result2
result3
result4
>
Thanks,
>

|||On 14 Sep 2006 19:05:04 -0700, nashak@.hotmail.com wrote:

Quote:

Originally Posted by

>Hello,
>
>In a Stored Proc, I am building a string variable. I am getting outputs
>from 4 different queries and would like the string to have line breaks
>to display each entry in a different line in a text area. How can I do
>this?


Hi Nashak,

In addition to the answers already given by Alexander and Dan, here's
another option - just use a newline character inside a string constant.

For example:

SELECT 'First line
Second line.'

This will show the output on two lines (make sure to select output to
text, not output to grid - the grid doesn't handle newlines too well).

If the data comes from columns, try

SELECT Column1 + '
' + Column2
FROM YourTable
WHERE ...

--
Hugo Kornelis, SQL Server MVP

Line Break formatting

I have a report with a narrow column. The column contains a comma delimited number list.

If the length of the string exceeds the width of the column then the line breaks. No problem with this, except that there are breaks between the numbers.

Example:

123,124,125,126

can be formatted as

123,12
4, 125,1
26

I'd like to force a break at a position within the string if its on the comma. Any thoughts on doing this in the Expressions window?

TIA

anyone please?|||you'll need to have space after the commas.|||

By assuming that all your number list of three digits than we can adjust the column width such that it fixes the numbers. if numbers are not fixed length digits than i wont think we can do .

|||The numbers can be any length (1 to n digits). They are also not always guaranteed to be numeric; they can be alphanumeric as well (but still sequential).|||Use vbcrlf. I'm putting a line break in my address with the below code. I tried \r\n, <br>, all kinds of stuff. vbcrlf is what I needed.

=Fields!SHIPTO.Value & vbcrlf & Fields!SHP_TO_CTY.Value & ", " & Fields!SHP_TO_ST.Value & " " & Fields!SHP_TO_ZIP.Value
|||vbcrlf will work but seeing as we're in the .NET world now I would recommend using Environment.NewLine

Line Break formatting

I have a report with a narrow column. The column contains a comma delimited number list.

If the length of the string exceeds the width of the column then the line breaks. No problem with this, except that there are breaks between the numbers.

Example:

123,124,125,126

can be formatted as

123,12
4, 125,1
26

I'd like to force a break at a position within the string if its on the comma. Any thoughts on doing this in the Expressions window?

TIA

anyone please?|||you'll need to have space after the commas.|||

By assuming that all your number list of three digits than we can adjust the column width such that it fixes the numbers. if numbers are not fixed length digits than i wont think we can do .

|||The numbers can be any length (1 to n digits). They are also not always guaranteed to be numeric; they can be alphanumeric as well (but still sequential).|||Use vbcrlf. I'm putting a line break in my address with the below code. I tried \r\n, <br>, all kinds of stuff. vbcrlf is what I needed.

=Fields!SHIPTO.Value & vbcrlf & Fields!SHP_TO_CTY.Value & ", " & Fields!SHP_TO_ST.Value & " " & Fields!SHP_TO_ZIP.Value
|||vbcrlf will work but seeing as we're in the .NET world now I would recommend using Environment.NewLine

Monday, February 20, 2012

Limit string lengh

There is a way to limit the length in characters returned by but I cant find what it is.

As an example, returning only the first 20 characters of a field.

Any help would be greatly appreciated.

You can either SUBSTRING or LEFT string functions in your case to get what you want. For example,

SELECTLEFT(yourcolumn, 20)AS col20_1,SUBSTRING(yourcolumn,1,20)as co20_2 FROM yourtable

You can find more string function from this link.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_fa-fz_7oqb.asp

Limno

|||Thank you!