Re: my dilemma -- hundreds of record types

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thank you!  This is what I was looking for.

(I'm still learning Eu and feel like a newbie... =)


--- Kat <kat at kogeijin.com> wrote:
> 
> On 15 Nov 2002, at 9:29, Chris Saik wrote:
> 
> > 
> > Hello Eu folks!
> > 
> > I am attempting to develop an application that
> will
> > read records from a daily FTP feed, sort the
> records
> > according to type, display pertinent information
> on
> > each record, and send that information to
> subscribers
> > based on their subscription options.
> > 
> > Each record has a corresponding template with
> variable
> > length fields. The fields are delimited by tags. 
> Some
> > of the fields are optional, and thus even the tags
> > thenselves do not appear in those records that do
> not
> > use them.  Here is a view of one of the smaller
> > templates, with sample information:
> > 
> > <PRESOL>
> > <DATE>1114
> > <YEAR>02
> 
> <snip>
> 
> > There are 9 major template types, but since a lot
> of
> > the fields are optional it boosts the number of
> > different record variations to hundreds.  The only
> > tags that truly remain constant are the first and
> last
> > (<PRESOL and </PRESOL> in the example above) and a
> few
> > others strewn throughout the record.  
> > 
> > What is, in your opinion, the best way to read in
> all
> > of these record variations so that I can easily
> work
> > with and manage the data?
> 
> Use gets() to read the file into a sequence, and
> then a simple loop thru the 
> sequence, to find the tags you are looking for.
> 
> <untested>
> ftpdata = fptdata & {gets(readfile)}
> 
> <untested>
> function findtag(sequence tag)
> for loop = 1 to length(ftpdata) do
>   if match(tag,ftpdata[loop]) then 
>     return ftpdata[loop] 
>   end if
> end for
> return ""
> end function
> 
> <untested>
> function ListAllTags
> sequence total, temp
> total = ""
> temp = ""
> for loop = 1 to length(ftpdata) do
>  temp = match(".",ftpdata[loop])
>  if not match(temp,total) then
>    total = total & {temp}
>  end if
> end for
> return total
> end function
> 
> Kat
> 
>
> 
> 
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu