ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DFDL for .csv manipulation

Post new topic  Reply to topic
 DFDL for .csv manipulation « View previous topic :: View next topic » 
Author Message
mpong
PostPosted: Tue May 02, 2017 2:56 pm    Post subject: DFDL for .csv manipulation Reply with quote

Disciple

Joined: 22 Jan 2010
Posts: 164

Requirement is to clear some of the field values on the .csv file before writing it into target system as per below.

First 3 columns are type and followed by header and Line as below. Need to clear the values on header,Line & LineSplit columns based on the 3 differnt type column field name. For instance id and status column values need to be cleared on header column .
(value 37546,approved need to cleared on header line)

Similarly invoice-id value need to be cleared on Line column (37546) (Second Type Column)

line-num need to cleared on LineSplit column (4444) (Third Type Column).

I have created a DFDL with choice and able to do it for the header line and not able to clear the fields on the Line and LineSplit yet.

Any suggestion would be great helpful.

type,id,created-at,updated-at,status,internal-note
type,invoice-id,invoice-line-id,created-at,updated-at
type,invoice-id,invoice-line-id,line-num,order-header-num
Header,37546,2017-04-14T21:23:06Z,2017-04-14T21:25:12Z,approved,test
Line,37546,42899,2017-04-14T17:23:06-05:00,2017-04-14T17:25:08-05:00
Line,37546,42899,2017-04-14T17:23:06-05:00,2017-04-14T17:25:08-05:00
LineSplit,3333,34343,4444,767676
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed May 03, 2017 4:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

what does it mean "cleared"?

If you have a CSV row definition that consists of "FieldA,FieldB,FieldC" - what does your output need to look like if any of these fields should be 'cleared'?

If you have a working configuration for one type of record in your DFDL and a non-working configuration for another type of record, then clearly the record definition properties are different.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
mpong
PostPosted: Thu May 04, 2017 7:47 am    Post subject: Reply with quote

Disciple

Joined: 22 Jan 2010
Posts: 164

if CSV row definition that consists of "FieldA,FieldB,FieldC" then output should like like "FieldA,FieldC" and this operation should be based on the first three type columns.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu May 04, 2017 8:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

mpong wrote:
if CSV row definition that consists of "FieldA,FieldB,FieldC" then output should like like "FieldA,FieldC" and this operation should be based on the first three type columns.


Ok, so let's pretend that FieldA = "123" and Field C = "ABC".

If FieldB was "DEF", then your output would be "123,DEF,ABC"

If FieldB is null, then your output would be "123,ABC".

Which field is "ABC" ? Is it FieldB, or FieldC? How do you know? How does the program reading the file know?

It would have to be "FieldA,,FieldC" to indicate that FieldB is missing.

In terms of using your LineSplit row to decide which columns need to cleared, you need to handle that with code. You will need to create a sequence of choice*"Header","Line"(repeats),"LineSplit")

Then you can use the fields of LineSplit to do what you need to each instance of Line - but this has to be done in code, not in the DFDL model.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
mpong
PostPosted: Tue May 16, 2017 2:16 pm    Post subject: Reply with quote

Disciple

Joined: 22 Jan 2010
Posts: 164

It worked after creating 4 separated xsd's with sequence type,header,line & line-split.

Had to write few lines of esql code to clear the fields.

IF( EXISTS(InputRoot.DFDL.linesplit."account-allocation-id"[])) THEN
SET OutputRoot.DFDL.linesplit."account-allocation-id" =''; END IF;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DFDL for .csv manipulation
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.