Author |
Message
|
sunny_30 |
Posted: Wed Sep 24, 2014 3:17 pm Post subject: Move NextSibling repeat question |
|
|
 Master
Joined: 03 Oct 2005 Posts: 258
|
what is difference in below 2 lines please:
MOVE myRef NEXTSIBLING REPEAT NAME;
MOVE myRef NEXTSIBLING REPEAT TYPE NAME;
thank you |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 24, 2014 3:27 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The word "TYPE"...
 |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 25, 2014 4:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
The word "TYPE"...
 |
Seriously.
Adding that parameter changes how MOVE works. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sunny_30 |
Posted: Thu Sep 25, 2014 6:56 am Post subject: |
|
|
 Master
Joined: 03 Oct 2005 Posts: 258
|
Lets assume its xmlns data, does it mean the 'REPEAT TYPE NAME' ensures the XML-schema datatypes AND the field-names match before the MOVE? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Sep 25, 2014 7:02 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
sunny_30 |
Posted: Thu Sep 25, 2014 8:40 am Post subject: |
|
|
 Master
Joined: 03 Oct 2005 Posts: 258
|
thank you !
so its not a dataType, its fieldType
Infocenter says " this is the type of the field, not the data type of the field that the parameter identifies."
i always used REPEAT NAME and omitted the TYPE clause in there.
May be its a best practice to use it if the intention would be move to same-named sibling field, typically XML data |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 25, 2014 12:26 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The REPEAT clause is just a shorthand so that the programmer does not have to re-specify the NAME and TYPE.
As you rightly said ( and you should really have looked in the info center before ) the TYPE is not the data type. It is the 'field type' which is NAME, NAMEVALUE or VALUE in most cases. XMLNSC and some other parsers use some parser-specific field types as well.
If you are navigating an XMLNSC message tree it is probably safest to specify the NAME explicitly, and not use the REPEAT clause. Why? Because XMLNSC almost always creates one NAMEVALUE element to represent a simple XML tag, but if the tag contains a mixture of CDATA and ordinary text it will instead create a NAME node with one or more VALUE children. So a REPEAT clause would be over-specific, and could cause the MOVE to skip the exceptional case.
In 99.9% of real-world scenarios, using REPEAT will be OK - but integration developers are paid to think about the 0.1% cases. _________________ 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 |
|
 |
sunny_30 |
Posted: Thu Sep 25, 2014 12:53 pm Post subject: |
|
|
 Master
Joined: 03 Oct 2005 Posts: 258
|
Thank you.
kimbert wrote: |
Because XMLNSC almost always creates one NAMEVALUE element to represent a simple XML tag, but if the tag contains a mixture of CDATA and ordinary text it will instead create a NAME node with one or more VALUE children. |
Just to clarify. So, for this example scenario you described, you are suggesting to use "REPEAT NAME" or "NAME 'fieldname'" but not "REPEAT TYPE NAME" correct ?
Assuming the sibling name to MOVE to, and the fieldname where the Ref is currently pointed to, are both same, wouldnt "REPEAT NAME" & "NAME 'fieldname'" result in same exact behavior ? |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 26, 2014 12:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
So, for this example scenario you described, you are suggesting to use "REPEAT NAME" or "NAME 'fieldname'" but not "REPEAT TYPE NAME" |
Yes - exactly that.
Quote: |
Assuming the sibling name to MOVE to, and the fieldname where the Ref is currently pointed to, are both same, wouldnt "REPEAT NAME" & "NAME 'fieldname'" result in same exact behavior ? |
Yes - I think they would. The REPEAT keyword just makes the intention more obvious and saves a few keystrokes. _________________ 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 |
|
 |
|