How do you add a line feed to a string (SOLVED)

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

How do you add a line feed to a string (SOLVED)

Post by ddumas »

I would like to append a linefeed to a string, but nowhere in the doc, or forum can I find a working example how to add a line feed to a string

SOLVED - Here is how you do it :

Jaymer and another user, forgot name... helped

Create a new column in SystemSettings - through the app is fine. Mine is LineFeedChar varchar(10)

For SQL Server:
update [dbo].[SYSTEMSETTINGS]
set LineFeedChar = char(13) + char(10)

Then this works:
'this is my string' + SystemSettings.LineFeedChar + SendMemberMessages .Message

and this works:
'this is my string <<SystemSettings.LineFeedChar>> <<SendMemberMessages .Message>>'

Thanks again to all who contributed.

Dave



I have tried:
'this is my string\n' + SendMemberMessages .Message
'this is my string' + '\u000D' + SendMemberMessages .Message
'this is my string' + '\n' + SendMemberMessages .Message
'this is my string' + '\\n' + SendMemberMessages .Message
'this is my string' + \\n + SendMemberMessages .Message

Nothing works. On most of the above, I do not get error messages.

Dave
Last edited by ddumas on Tue Dec 10, 2019 1:11 am, edited 1 time in total.
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: How do you add a line feed to a string?

Post by Jaymer »

Last edited by Jaymer on Mon Dec 09, 2019 8:47 pm, edited 1 time in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string?

Post by ddumas »

I read the entire forum post as best I could. I think the summary was to use '\n'

Does not work. I have tried that before from my last post:

'this is my string' + '\n' + SendMemberMessages .Message

That just adds the literal \n to this is my string
So the string just becomes: this is my string\n

Dave
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string?

Post by ddumas »

I even tried adding an attribute SystemSettings.LineFeedChar, and saved a \n into it.

Same result:

'this is my string' + SystemSettings.LineFeedChar + SendMemberMessages .Message

just adds the literal \n to this is my string
the string just becomes: this is my string\n
chris29
Posts: 173
Joined: Sat Feb 06, 2010 1:45 am
Location: Australia

Re: How do you add a line feed to a string?

Post by chris29 »

Have a look at

https://www.awareim.com/forum/viewtopic ... age+Return

there is a sample bsv
Version 8.5 - Windows using MySql 8 and SQL Server - 64bit
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string?

Post by ddumas »

I looked at that post, and the only difference I saw is a suggestion to go into system settings and hit a carriage return in the SystemSettings.CR attribute, and save.
I tried that, and did not get a line feed.

Dave
chris29
Posts: 173
Joined: Sat Feb 06, 2010 1:45 am
Location: Australia

Re: How do you add a line feed to a string?

Post by chris29 »

have to tried this


'this is my string <<SystemSettings.LineFeedChar>> <<SendMemberMessages.Message>>'
Version 8.5 - Windows using MySql 8 and SQL Server - 64bit
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: How do you add a line feed to a string?

Post by Jaymer »

no no no no no no no

ok, my bad, Dave.
I incorrectly posted a link to the entire thread instead of just my post.
All you need is MY POST in that thread - I have updated the link above - you just needed to make a CR field in System Settings and update it as specified in my post.
done

PS _ While you're at it, go ahead and make SQ and DQ for Single Quote and Double Quote, you'll need them eventually.
Set them with a ' and "
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string?

Post by ddumas »

same result. :(
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: How do you add a line feed to a string?

Post by Jaymer »

not sure what your issue is - if you have a char(13) in your CR MSSQL field, then this is a working example of how I build a text string at the top of an invoice to show Customer details.

tmp_Customer_Addr_Block is a large Text field in the User table.
Before I print the report, I call this to build the string:

LoggedInStaffMembers.tmp_Customer_Addr_Block=
EstimateCont.ob_Contact2.ob_Customer.BusName+SystemSettings.CR+
EstimateCont.ob_Contact2.Address+SystemSettings.CR+
EstimateCont.ob_Contact2.City+', '+EstimateCont.ob_Contact2.State+' '+EstimateCont.ob_Contact2.ZipCode+SystemSettings.CR+
EstimateCont.ob_Contact2.ContactName+SystemSettings.CR+
EstimateCont.ob_Contact2.EmailAddress+SystemSettings.CR+
'Office: '+EstimateCont.ob_Contact2.PhoneOff+' / Mobile:'+EstimateCont.ob_Contact2.PhoneMobile
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string?

Post by ddumas »

I had used AwareIM SystemSettings editor to add the CR. I will try now, directly in a SQL update, and let you know.
Dave
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string (SOLVED)

Post by ddumas »

Solved!
Dave
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: How do you add a line feed to a string (SOLVED)

Post by Jaymer »

solved how, sql god?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: How do you add a line feed to a string (SOLVED)

Post by ddumas »

Ha!

I edited my post, and put this at the top of my post...:

SOLVED - Here is how you do it :

Jaymer and another user, forgot name... helped

Create a new column in SystemSettings - through the app is fine. Mine is LineFeedChar varchar(10)

For SQL Server:
update [dbo].[SYSTEMSETTINGS]
set LineFeedChar = char(13) + char(10)

Then this works:
'this is my string' + SystemSettings.LineFeedChar + SendMemberMessages .Message

and this works:
'this is my string <<SystemSettings.LineFeedChar>> <<SendMemberMessages .Message>>'

Thanks again to all who contributed.

Dave
Post Reply