Flat File Parsing - Repeating Data where a line contains an 'array'

Hi There,

I’ve been familiarising myself with webMethods over the last few days. One task I have is to convert a flat file schema defined in BizTalk to one in webMethods.

At first blush I think what I want to achieve is not possible using the FF Schema tools. I have a record (with no record identifier) which contains all data on a single line. It is column delimited.

An example would be something like this:

SMITH  JOHN  20080504YYNGREENRED  BLUE ORNGE
DOE    JANE  20061221YNYRED  PRPLEGREY PINK
KEITTELHARVEY20051221NNYINDIGYELLOLIME PUCE PINK RED  WHITE

So the first 6 fields, (surname, firstname, date, flag1, flag2, flag3) are essentially header. Everything that follows is an ‘array’ of colours. I suppose you could call it detail, which clearly repeats.

The way this structure has been done in biztalk is to define the colours column as repeating group for some arbitrary number of occurrences (although I think it can be unbounded as well). Thus it only has to be defined once, all the colours are picked up and can be treated as a stringList (to use wm terminology).

I can’t see a way to do that using the FFSchema. Never mind the idea that repeating groups in a flat file structure is a little incongruous in the first place.

The way I think I am going to do it is to define a record in a FFDict which extract the header, then a long string field to capture the remaining data for the row.

Then I will take the node that represents the remaining data and map it against another FFSchema.

Then join it all together and feed it into a canonical form.

I’m probably mixing terminology here but does this approach make sense? Or is there some aspect about ff schemas that I have missed?

Delimeter in your case is space(’ ').

wat happens when you create a Flat file schema with New records as a new line. And delimiter as a space ?

One approach might be to not define any fields in the FF schema after the “header” fields. And have the FF service return the remaining data in the record as “undefined data.” Then you can either use another FF schema to parse that, or use the tokenize service to convert the string into a string list using the field delimiter. Map both the result of the convertToValues and the tokenize to an IS document (defined by an IS doc type) and you should have what you’re after.

Chris, I did the same way (but not exactly, as my requirement is slightly different) as mentioned by Rob in one of my Projects. I used just 2 schema’s to accomplish the task.

Thank you all, esp Rob. I’ve only just returned to this and it was was pretty straightforward in the end. I did it in a similar way as well, but I defined a specific field in my schema for my ‘array’ data.