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 » Dynamically setting min occurs in mapping node

Post new topic  Reply to topic
 Dynamically setting min occurs in mapping node « View previous topic :: View next topic » 
Author Message
sasad
PostPosted: Thu Sep 18, 2014 1:08 am    Post subject: Dynamically setting min occurs in mapping node Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

Hi all,

I want to dynamically set min occurs property to 0 or 1 depending on the value of other field in model. for e.g

I have two fields MessageType and Status. If MessageType is 'AB' then Status in message is required (min Occurs should be '1'). If MessageType is 'AC' then Status is not required (min Occurs should be '0').

Can this be done in Message Model?

Thanks,
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 18, 2014 4:41 am    Post subject: Re: Dynamically setting min occurs in mapping node Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sasad wrote:
Can this be done in Message Model?




Depending on which version you're using (hence MRM or DFDL) use the AB or AC to drive a choice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sasad
PostPosted: Thu Sep 18, 2014 4:51 am    Post subject: Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

Message model type is DFDL. I tried this by setting an expression in OccursCountKind property.

Field separator for DFDL is '|'. Below is part of actual model. I tried parsing a file with transaction type 'MPC' and no 'NEWMPIN' field. It is parsing successfully instead of throwing an error. as per expression 'NewMPIN' field should be required if Transaction type is 'MPC', but this is not working.

Code:
<xsd:element ibmSchExtn:docRoot="true" name="Step1VerificationReqModel">
      <xsd:complexType>
         <xsd:sequence dfdl:separator="|" dfdl:separatorSuppressionPolicy="trailingEmpty">
                  <xsd:element ibmDfdlExtn:sampleValue="value1" name="MessageType" type="xsd:string"/>
                      <xsd:element ibmDfdlExtn:sampleValue="value2" name="TransactionType" type="xsd:string"/>
                  <xsd:element ibmDfdlExtn:sampleValue="value3" name="CNIC" type="xsd:string"/>
                        <xsd:element name="MobileNumber" type="xsd:string"/>
                        <xsd:element dfdl:occursCount="{xs:nonNegativeInteger(if (fn:contains('MPG',/Step1VerificationReqModel/TransactionType) or fn:contains('MPC',/Step1VerificationReqModel/TransactionType)) then 1 else 0)}" dfdl:occursCountKind="expression" minOccurs="0" name="OldMPIN" type="xsd:string"/>
                      <xsd:element dfdl:occursCount="{xs:nonNegativeInteger(if (fn:contains('MPC',/Step1VerificationReqModel/TransactionType)) then 1 else 0)}" dfdl:occursCountKind="expression" minOccurs="0" name="NewMPIN" type="xsd:string"/>
                        <xsd:element dfdl:terminator="" minOccurs="0" name="Terminator" type="xsd:string"/>
            </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 18, 2014 6:03 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sasad wrote:
Message model type is DFDL. I tried this by setting an expression in OccursCountKind property.


And that doesn't work? Wow, I wish I'd suggested using a choice rather than setting that.


_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sasad
PostPosted: Thu Sep 18, 2014 6:06 am    Post subject: Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

I don't know how to use choice.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 18, 2014 6:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sasad wrote:
I don't know how to use choice.


Well one day it's likely you'll need to, even if not for this, so some research and learning would seem to be in order.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sasad
PostPosted: Thu Sep 18, 2014 11:03 pm    Post subject: Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

I have Schema for ISO8583. It has Primary Bit map field which is used to tell if field(s) is present or not in message. expression in OccusCountKind property is used for all other fields. Which is working totally fine. I don't understand why this is not working in my case.

@Vitor Can you suggest me some examples of Choice , I tried some search but didn't find any useful links.
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 » Dynamically setting min occurs in mapping node
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.