Formatting

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
Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Formatting

Post by Glenn Boyce » Wed May 26, 2010 7:31 am

I have brought in a text file which is a report. I have removed the superfluous lines and find I can't format it into items. Any ideas?
I tried setting delimiter to tab and putting it into a table field but doesn't work

1000587 CATR SMARTCHOICE 33X600D 33X600D X 6 BT C50 SP 0 24 0 0 0 24 88 0.27
1000588 CATR SMARTCHOICE 45X600D 45X600D X6 BT C50 SP 0 0 0 0 0 0 104 0.00
1000476 MPMR CWAYZIP 33X600R 33X600 BT C50 R X6 SP 36 288 0 0 0 288 92 3.13
1000477 MPMR CWAYZIP 45X600R 45X600 BT C50 RX6 SP 48 216 0 0 0 216 104 2.08
1000507 MPMR CWAYZIP S 33X300D 33X300D X6 BT C50 SP 0 240 0 0 0 240 80 3.00
1000472 MPMR CWAYZIP S 33X600D 33X600D X 6 BT C50 SP 468 888 0 0 0 888 1892 0.47
1000473 MPMR CWAYZIP S 45X600D 45X600D X6 BT C50 SP 648 1464 0 0 0 1464 3328 0.44
1000354 MPMR CWISE ZP 33X600D 33X600 NA C50 DX6 SP 0 480 0 0 0 480 528 0.91
1000355 MPMR CWISE ZP 45X600D 45X600 NA C50 DX6 SP 0 48 0 0 0 48 234 0.21
1000262 MPMR SPDW S 15X15X500 15X15X500 BT C34 P X3 SP 0 12 0 0 0 12 13 0.92
1000264 MPMR SPDW S 25X25X500 25X25X500 BT C34 P C3 SP 0 17 0 0 0 17 24 0.71
1000265 MPMR SPDW S 30X30X500 30X30X500 BT C34 P X3 SP 0 1 0 0 0 1 14 0.07

Strangely enough when i wrote this i put the example in as code and it automatically fomatted the data into columns

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Contact:

Re: Formatting

Post by Curry » Wed May 26, 2010 9:38 am

Maybe: replace space with tab in mydata
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: Formatting

Post by doc » Thu May 27, 2010 2:01 pm

Glenn,
It looks like you might have a "fixed width field" file, which in case you will need the "key" describing the placement for each field length. Once you know where the field boundaries are, you can open/convert it in Excel or Open Office... or it's pretty simple to work with the data directly using Rev if that's what you prefer.

...the key is the "key" :)

-Doc-

Edit:
I added an image of a key supplied to me recently and you should note that not all "keys" are going to be in this format. Sometime the field lengths are described in the top few rows/lines of the data file itself.
Attachments
fixed_fld.gif
fixed_fld.gif (27.8 KiB) Viewed 4236 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Formatting

Post by dunbarx » Thu May 27, 2010 6:49 pm

Glenn.

Make sure you understand what Curry said. It seems like the solution is the simple one he mentioned. He may have been a bit terse.

Did you get the data by reading from a file? If so, the data will be in the variable "it".

put it into myData --always a good idea to free "it" for other things
replace space with tab in myData

Your data will be tab delimited. The returns I assume are OK?

I am not sure if what looks like spaces in the data you posted are really just that. If they are not, find out what they are and substitute. Make sure there is only one character in that "space".

Craig Newman

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Re: Formatting

Post by Glenn Boyce » Fri May 28, 2010 12:17 am

Thank you both for your help. I am currently exporting a text file from an ERP system and converting it in excel then uploading it manually into my Rev application. To import it into excel i have to use the fixed width conversion, so I guess that answers that question. I was trying to automate the process and had got a reasonable way down the track managing to remove headers, page breaks and the like but got stuck with the formatting (and uploading and reading the file which i haven't managed to resolve yet). It's a lot of mucking around to save a job that takes about a minute to do manually once a week!!

Post Reply