Author |
Message
|
zpat |
Posted: Wed Apr 09, 2014 10:21 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
mqsiuser wrote: |
Vitor wrote: |
mqsiuser wrote: |
I (and others) think that it has limitations |
Of course it does (though the v9 one has far fewer). That's why IBM provided other transformation tools. |
zpat does not see (any) limitation (of the mapping node) on his project(s)
Which I agree is possible |
I never said anything of the sort. However one should recommend (to a beginner) the simplest solution before jumping into (potentially) unnecessary code.
I realise that old hands have a horror of the (old) mapping node but that is no reason not to use the current one, unless it can't do the job. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
mqsiuser |
Posted: Wed Apr 09, 2014 8:30 pm Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
kimbert wrote: |
In a Compute node ( or a Mapping node, if you prefer ) |
mqjeff, I and incredibly lots of other people just always use ESQL because requirements change
If you consider that hash maps are for message transformation what indexes are for databases, and then ...
... there is nothing like a hash map (curly braces magic) in "graphical mapping" (it's a contradictory concept)
It's theoretically impossible (and actually also practically) _________________ Just use REFERENCEs |
|
Back to top |
|
 |
MB Developer |
Posted: Thu Apr 10, 2014 1:06 am Post subject: |
|
|
 Disciple
Joined: 03 Feb 2014 Posts: 179
|
kimbert wrote: |
kr.danda must be somewhat confused by all of that.
The recommended way to do this is:
a) Use the CSV wizard in the toolkit to create a DFDL schema for your CSV format.
b) Parse the input document using XMLNSC
c) In a Compute node ( or a Mapping node, if you prefer ) copy InputRoot.XMLNSC to Output.DFDL
If using v7, then a) will need to change to:
a) Create a message set for the CSV format, using the CSV sample as a guide. |
Hi kr.danda
In compute node yo can use like this...
Sample Code for output:
SET OutputRoot.DFDL.SubTotal_CSV_MsgSet.header.Year = 'Year';
Sample Code for input :
SET OutputRoot.DFDL.SubTotal_CSV_MsgSet.record[I].Year = InputRoot.XMLNSC.SubTotals.sub.Year; |
|
Back to top |
|
 |
zpat |
Posted: Thu Apr 10, 2014 1:39 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
mqsiuser wrote: |
kimbert wrote: |
In a Compute node ( or a Mapping node, if you prefer ) |
mqjeff, I and incredibly lots of other people just always use ESQL because requirements change
If you consider that hash maps are for message transformation what indexes are for databases, and then ...
... there is nothing like a hash map (curly braces magic) in "graphical mapping" (it's a contradictory concept)
It's theoretically impossible (and actually also practically) |
You want to check out the new mapping node - I believe it has some quite flexible features (cue Mr Anthony Dowd!) and is not simply a dumb field to field mapper. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 10, 2014 1:58 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
You want to check out the new mapping node |
mqsiuser knows it well. And disapproves of it, along with everything else that uses or depends on XSLT or XPath. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
zpat |
Posted: Thu Apr 10, 2014 2:10 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
From a quick glance at the help pages - I see that you can add snippets of ESQL, Java and other stuff to the mapping logic. In fact there seems little that you can't do.
Of course you don't have to use it. But going back to the dawn of MQSI, the selling point was the idea that you can develop flows graphically and not have to code.
Having maintained some compute nodes with 2000 lines of ESQL, I think maybe that was an idea before its time (14 years ago), but not so much now. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Apr 10, 2014 8:08 pm Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
I can't help if you don't understand like mathematical proof language (which is what I use/say)
People tend to be not good at math and also there are mistakes made on mathematical proofs.
But it's not that people criticise things on top of XML any more (XSLT, SOAP, WS-*)
It is much worse...
XML itself is on the line and the replacement people use is JSON
So again: We have been discussing "on top" XML-Technology (a couple of years ago) and how (un)useful it is
Today we (the IT world) are discussing how to get rid of XML itself
Relax, I was once totally and 100% convinced about that Microsoft is the greatest company in the world and that Linux(Unix) is crap
I have changed my mind on that successfully over a couple of years _________________ Just use REFERENCEs |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Apr 10, 2014 10:21 pm Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
And on the actual topic:
I do not understand that people always have simple requirements:
One msg(-structure) --> one msg set
E.g. generic flow (error handling likely), sending off any msg as CSV (attached to an eMail)
NOT possible/reasonable (by creating msg sets) _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kr.danda |
Posted: Tue Apr 15, 2014 6:18 am Post subject: XML to CSV converter Soluton |
|
|
Novice
Joined: 08 Apr 2014 Posts: 15
|
CREATE COMPUTE MODULE XML_CSV_XML_To_CSV
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
/* Declare Reference Variable */
DECLARE inRef REFERENCE TO InputRoot.XMLNSC.*:employees;
DECLARE outRef REFERENCE TO OutputRoot;
DECLARE index integer 1;
/* Traverse Each Input Record and build Output Record */
FOR eachInRecord AS inRef.employee[] DO
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].name=eachInRecord.name;
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].age=eachInRecord.age;
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].dept=eachInRecord.dept;
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].salary=eachInRecord.salary;
SET index=index + 1;
END FOR;
RETURN TRUE;
END;  |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Apr 15, 2014 6:22 am Post subject: Re: XML to CSV converter Soluton |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
I almost can't look at this code:
You are not honoring the rules (and you should)
Only break the rules if you know them well (you do not seem to know them well)
Look here for inspiration: http://www.mqseries.net/phpBB2/viewtopic.php?t=66721 _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kr.danda |
Posted: Tue Apr 15, 2014 6:49 am Post subject: Re: XML to CSV converter Soluton |
|
|
Novice
Joined: 08 Apr 2014 Posts: 15
|
kr.danda wrote: |
CREATE COMPUTE MODULE XML_CSV_XML_To_CSV
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
/* Declare Reference Variable */
DECLARE inRef REFERENCE TO InputRoot.XMLNSC.*:employees;
DECLARE outRef REFERENCE TO OutputRoot;
DECLARE index integer 1;
/* Traverse Each Input Record and build Output Record */
FOR eachInRecord AS inRef.employee[] DO
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].name=eachInRecord.name;
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].age=eachInRecord.age;
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].dept=eachInRecord.dept;
SET OutputRoot.DFDL.POC_DFDL_CR.record[index].salary=eachInRecord.salary;
SET index=index + 1;
END FOR;
RETURN TRUE;
END;  |
Thank You All.... |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 15, 2014 8:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Again you should know better.
Remove that index and use references...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 15, 2014 12:06 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Before MGK says it...
This could be done in one line of ESQL, if you use a SELECT statement. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|