newbie question on fields

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm

newbie question on fields

Post by churchken » Mon Apr 16, 2007 1:24 pm

Hi,

The following script correctly "puts" a text file into a variable. The accurate number of characters is placed into the card variable "filesize".

put URL ("file:" & it) into tFileData
put the number of characters in tFileData into tFileChars
put tFileChars into field "filesize"
put tFileData into field "DataText"

However, the "field" "DataText" on a card only receives a portion of the text data, not the total number of characters. Is there a reason for the text to be limited in size? Is there a way to set the size of the text field?

Thanks -- and be prepared for more questions from this newbie !
Ken

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Apr 16, 2007 3:56 pm

Hi Ken,

What kind of file are you trying to import? If it is a plain text file, this should just work. If not, could you please tell a little more about it?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm

file type

Post by churchken » Mon Apr 16, 2007 4:31 pm

Mark,

The file being imported is a plain text file -- however, it contains some html code characters. Here is a portion of the file:

<br>04/13/2007 ZN 07Jun 107085 12:35:33 PM 100<br>04/13/2007 ZN 07Jun 107085 12:35:33 PM 153<br>04/13/2007 ZN 07Jun 107085 12:35:33 PM 14<br>04/13/2007 ZN 07Jun 107085 12:35:34 PM 1<br>04/13/2007 ZN 07Jun 107085 12:35:34 PM 2<br>04/13/2007 ZN 07Jun 107085 12:35:34 PM 305<br>04/13/2007 ZN 07Jun 107085 12:35:35 PM 100<br>04/13/2007 ZN 07Jun 107085 12:35:35 PM 182<br>04/13/2007 ZN 07Jun 107085 12:35:35 PM 100<br>04/13/2007 ZN 07Jun 107085 12:35:35 PM 5<br>04/13/2007 ZN 07Jun 107085 12:35:35 PM

If you would like to see the entire file, I would gladly email it to you.

Thanks so much for your assistance.
Ken

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Apr 16, 2007 4:36 pm

Hi Ken,

I have no idea why Rev would cut off the data when displaying it in a field. Feel free to send your stack and the text file to m . schonewille (at) economy-x-talk . com . I'll have a look.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm

data file

Post by churchken » Mon Apr 16, 2007 5:17 pm

Mark,

Thanks so much -- stack & data file to import have been emailed to you.

Please let me know if you can duplicate this problem.

Best regards,
Ken

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Apr 16, 2007 10:42 pm

Hi Ken,

Thanks for the stack and the data. Your file is a very messy HTML file, with lots of spaces in the beginning, some javascript and more garbage in the first 5456 (!) lines of the file. I just can't believe that people design web sites like this.

The actual data start with a header that looks as follows:

Date Com Mth Price Time Type Volume

---------- ----- -------- ------ --------- ------------ -----------

Unfortunately, the data following this header doesn't contain any linefeeds. As a result, the data consist of one line with a length equal to 65533 or more. Revolution cannot display lines that long and therefore the data is cut off at that line when displayed in a field.

You can solve this by including the line

Code: Select all

    replace "<br>" with "<br>" & cr in tFileData
in your script, right after the line that reads the data from the file. This will break up the data into smaller lines that can be displayed in a field.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm

like a charm !

Post by churchken » Mon Apr 16, 2007 10:54 pm

Mark,

That worked perfectly to bring the whole file into the text field.

Thanks a bunch.

Best regards,
Ken

Post Reply