1. i'm confused?
- Posted by Steven G Astley <sgastley at HOTMAIL.COM> Oct 10, 1999
- 434 views
Rob's helped some, thx Rob, ... but ... Can Euphoria(U4) handle business applications? I need to read ASCII, comma delimited files of several thousand records with a dozen variable length fields, load into a table/array, massage the field data in many ways, do some statistical analysis and print a report. Is this possible? eg,record layout: date, var1, var2, var3, var4, var5, var6 Does anyone have an example of this type of processing? or portions there of? I don't understand how U4 can handle field processing. Can it? thx, sga ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
2. Re: i'm confused?
- Posted by Irv <irv at ELLIJAY.COM> Oct 10, 1999
- 413 views
----- Original Message ----- From: Steven G Astley <sgastley at HOTMAIL.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Sunday, October 10, 1999 8:46 AM Subject: i'm confused? > Rob's helped some, thx Rob, ... but ... > > Can Euphoria(U4) handle business applications? Yes. I have several being used daily - mostly accounts receivable/payable stuff. Most of them are written using Dave's Win32Lib. They run at amazing speed, compared with, for example, VB.(using the same data files). > I need to read ASCII, comma delimited files of several thousand records > with a dozen variable length fields, load into a table/array, massage the > field data in many ways, do some statistical analysis and print a report. > Is this possible? Yes. There are no "structures" or "records" in Euphoria, so you must make your own. A record is just a sequence, with each field being a sequence within that sequence. You can reference the (sub) sequences by number or by name, if you declare constants to the fields: DATE = 1, Var1 = 2,,, You'll have to write your own file read/parse functions. Assuming the files are standard (each record ending in a c/r) this is pretty easy - just a few lines of code. You'll have to decide whether to just import the data, and save it in Euphoria native format, or whether it will be necessary to read and write in the original format. > Does anyone have an example of this type of processing? or portions there > of? I don't understand how U4 can handle field processing. Can it? Sure. I will be glad to share what I can. I have code which imports DBase files, and code to read and write standard Pascal and VisualBasic records. No point in posting these; they are specific to the applications. e-mail me privately so we can discuss this in more detail. Regards, Irv
3. Re: i'm confused?
- Posted by Steven G Astley <sgastley at HOTMAIL.COM> Oct 10, 1999
- 463 views
- Last edited Oct 11, 1999
Thanks Irv for your response. I've outgrown QBasic and hope U4 can do the job. As I said I'm reading ASCII comma delimited files of 7 fields directly into an array/table. In Qbasic, i increment the row and column numbers, how functionally, do i do that in U4? From there I heavily massage the data, creating new array elements based on the data, and print a report (probably wont need output files for some time). How do I address each row and column in my array/table ... i seem to be missing something conceptually. thanks, steve ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
4. Re: i'm confused?
- Posted by Bernie Ryan <bwryan at PCOM.NET> Oct 11, 1999
- 429 views
What is U4 ???????
5. Re: i'm confused?
- Posted by Steven G Astley <sgastley at HOTMAIL.COM> Oct 11, 1999
- 426 views
What is U4 ??????? Sorry for the shorthand: U4=Euphoria. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
6. Re: i'm confused?
- Posted by Irv Mullins <irv at ELLIJAY.COM> Oct 11, 1999
- 415 views
On Sun, 10 Oct 1999, you wrote: > I've outgrown QBasic and hope U4 can do the job. As I said I'm reading > ASCII comma delimited files of 7 fields directly into an array/table. In > Qbasic, i increment the row and column numbers, how functionally, do i do > that in U4? (Let's use a mailing list of customers as an example) First, we create an empty customer list: sequence CustomerList CustomerList = {} We can create an empty "record" as follows: sequence customer customer = {"","","",0,"",0,""} -- assuming that there will be 3 "string" fields -- then a numeric field, a string field, another number, and another string -- Here, we are assuming that there will be a fixed number of fields -- in each customer record. Then, you read in a line of data, parse the fields, and store them like this: customer[1] = parsed_data1 customer2] = parsed_data2..... or, if named fields are easier to deal with, you can declare constants: NAME = 1, ADDR = 2, CITY = 3.... and store the data like so: customer[NAME] = parsed_data1 customer[ADDR] = parsed_data2... Once the customer "record" is filled in, we can add it to our list: CustomerList = append(CustomerList,customer) To determine the number of customers on the list, we use length(CustomerList). To access a given customer 'n" from the CustomerList, we can specify CustomerList[n] To access a "field" within the customer's record, we can access it as: CustomerList[n][NAME] i.e. CustomerList[3][NAME] = "Irv Mullins" or printf(1,"Customer name is: %s",{CustomerList[3][NAME]}) ---You didn't ask, but you may run into a need to do something fancier: It is also possible to do a kind of "variant" record, and records with no pre-determined number of fields, i.e. our customer record could contain name, address, etc, plus a sequence (list) of any number of transactions, each of which might contain, say, a date, amount, invoice #, etc. constant NAME = 1, ADDR = 2, CITY = 3, TRANSACTION = 4, TxnDATE = 1, TxnAMT = 2, TxnINV = 3 sequence customer , transaction customer = {"","","",{}} -- 4th entry is the empty transaction store transaction = {{},0,0} -- date as yr,mo,da, amt, inv# Each new transaction would simply be filled in and appended to the customer's record: transaction[TxnDATE] = {1999,12,30} transaction[TxnAMT] = 12.99 transaction[TxnINV] = 123456 CustomerList[n][TRANSACTION] = append(CustomerList[n][TRANSACTION],transaction) Do this as many times as you want. Transaction x for customer n can be accessed CustomerList[n][TRANSACTION][x] Amounts could be accessed as CustomerList[n][TRANSACTION][x][TxnAMT] The number of transactions can be obtained by length(CustomerList[n][TRANSACTIONS]) Hope this helps. Irv