Exporting more than one line of text in a fld

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

Exporting more than one line of text in a fld

Post by wee wullie » Sat Sep 07, 2013 4:18 pm

I am trying to export text from a stack to a vb file , one of the fields has two lines of text in it, the problem is that when i try to send the data both lines are included in the string, starting and ending with a " but because i use a cr to put it into two lines it wont send it, i need each line to start and end with "
i can send it as one line ok but when i use return to put it into two lines it wont send

i hope someone knows what i mean

wee wullie

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting more than one line of text in a fld

Post by Klaus » Sat Sep 07, 2013 4:22 pm

Hi wullie,

for storing (or sending or whatever) multiline text in ONE line, I always "urlEncode" the string.
And later "urlDecode" it to get the multiline text back.

No problem if you urlEncode and then urlDecode a one-liner :D


Best

Klaus

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

Re: Exporting more than one line of text in a fld

Post by wee wullie » Sat Sep 07, 2013 5:29 pm

Hi Klaus, i tried to use urlencode for the entire string and just the variable and it doesn't seem to work, this is the string:

Code: Select all

put "Tr Type:" && the selectedText of btn "TrType" of stack "myStack"  & cr & "Tk Type:" && the Text of fld "TkType"  of stack "myStack" into tParr
perhaps i'm missing something

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting more than one line of text in a fld

Post by Klaus » Sat Sep 07, 2013 5:44 pm

WHAT did you try?
Something like this:
...
put "Tr Type:" && the selectedText of btn "TrType" of stack "myStack" & cr & "Tk Type:" && the Text of fld "TkType" of stack "myStack" into tParr
put urlEncode(tParr) into tVarWith_the_ONE_liner
...
?

Need to look at the script(s), since this has been working for many, many years for me 8)

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting more than one line of text in a fld

Post by Klaus » Sat Sep 07, 2013 5:51 pm

You can of course urlencode your string directly, no need for an extra variable:
...
put urlencode("Tr Type:" && the selectedText of btn "TrType" of stack "myStack" & cr & "Tk Type:" && the Text of fld "TkType" of stack "myStack") into tParr
...
:)

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

Re: Exporting more than one line of text in a fld

Post by wee wullie » Sun Sep 08, 2013 10:27 am

Hi Klaus, i tried to use this:

Code: Select all

on mouseUp
   open stack "FTdoc"
   put "FTr" && "--" && fld "firstname" of stack "FTDoc" &&  fld "lastname" of stack "FTDoc"into fld "Subject" of stack "myStack"   
   put urlencode( "TrType:" && the selectedText of btn "TrType" of stack "FTDoc" & cr & "TkType:" && the Text of fld "TkType"  of stack "FTdoc") into tParr
   put tParr into fld "Body" of stack "myStack"
end mouseUp
i think this is the direct way

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting more than one line of text in a fld

Post by Klaus » Sun Sep 08, 2013 11:41 am

Well, that's what I wrote in my last posting 8)

wee wullie
Posts: 78
Joined: Fri Oct 03, 2008 10:13 am

Re: Exporting more than one line of text in a fld

Post by wee wullie » Sun Sep 08, 2013 12:11 pm

Indeed it certainly was Klaus :oops:

its good that you can use both methods, transcript is very flexible, i love it!!!

cheers Klaus

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Exporting more than one line of text in a fld

Post by Klaus » Sun Sep 08, 2013 12:45 pm

Hi wullie,

well, sometimes it is desired to use an "intermediate" variable,
e.g. this way you can see what's in that string/variable when debugging!


Best

Klaus

Post Reply