IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Parse string field into variable structure Options · View
Julian
Posted: Friday, August 14, 2015 2:03:04 PM
Rank: Newbie

Joined: 6/11/2015
Posts: 8
Location: UK
Hi
I've been struggling with an design issue this week and would be grateful of any help or pointers you could offer.

Basically, I have to create a mapping that will accept a variable format FLF, whereby the header fields are common, but the rest are not. I have no influence over the input data.

The scenario is that these are order files (hence the common header fields) with item level fields that, although drawn from a common set, vary depending on the item being ordered.
e.g. some may contain a size, some may not, or colour and so on.

The set of fields is reasonable in number, 20 or so, but there are many variations between item types. So, I am trying to find a solution that is easily maintainable and does not mean too much repeated structure set up for example.

I went down a path whereby I have a common input; all header fields split nicely, and then the remaining information is stored in a single field, to be split out during the mapping (I hoped). However, this is where I have got stuck, because the solution I thought I had will not compile in C# (Text file - simple processing for FLF - "Parse Strings to FLF" option).

I've created a very much simplified structure to illustrate the issue. Less fields. FLF in, Tab delimited out. I have included the mapping, flextexts and sample input data, and required output sample from that data. There's a text doc showing the field structure too.

Again, any help would be very much appreciated.

Julian

File Attachment(s):
FieldStruc.txt (2kb) downloaded 267 time(s).
CommonInput.mft (2kb) downloaded 307 time(s).
CommonOutput.mft (2kb) downloaded 250 time(s).
DesignProblem.mfd (4kb) downloaded 269 time(s).
sampleData.txt (1kb) downloaded 249 time(s).
sampleOutput.txt (1kb) downloaded 282 time(s).


island
Posted: Monday, August 17, 2015 10:00:33 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

take a look at the attached mapping and input flextext file which demonstrate one way to do it.


File Attachment(s):
DesignProblem_amended.zip (5kb) downloaded 267 time(s).


Julian
Posted: Monday, August 17, 2015 10:18:13 AM
Rank: Newbie

Joined: 6/11/2015
Posts: 8
Location: UK
Hi

Thanks a lot for taking time to consider this.

That's very similar to the solution I have managed... although it's a scenario I was trying to avoid, as we may have quite a number of different orders items, and in reality there are many more fields per item than in the example. It soon becomes unwieldy.

Also, each time we are sent a new type of item, I have to change the design of the mapping, and these are deployed remotely to be used in an automated system, and best left alone once in place!

My other solution was to split it out in Flextext before hand.

I'm so annoyed that I cannot use string (only file) as input or the FLF component when using c#, as parsing the variable becomes easy. Although this still means I have to edit the mapping for new products, it's just easier to define.

any idea why this is?

Julian

File Attachment(s):
DesignProblem3.mfd (31kb) downloaded 252 time(s).


island
Posted: Tuesday, August 18, 2015 8:10:58 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
"Parse Strings to FLF" is only supported by the Mapforce built-in engine:

http://manual.altova.com/Mapforce/mapforceenterprise/mff_string_parsing_serialization.htm

You could also try using a switch statement in your source FlexText template see attached mapping.

File Attachment(s):
DesignProblem_amended2.zip (4kb) downloaded 276 time(s).


Julian
Posted: Tuesday, August 18, 2015 8:53:04 AM
Rank: Newbie

Joined: 6/11/2015
Posts: 8
Location: UK
Hi island

Thanks a lot. I managed it with a split too.

I hear today that going forward, I will have 100s of different items to contend with! Potentially 100s of gates to that switch.... :o(
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.