[jpos-users] FSDMsg, how to handle optional fields?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jpos-users] FSDMsg, how to handle optional fields?

Dan MacLeod


Using the sample schema below, I'm trying to use a FSDMsg to send commands to an HSM. My problem comes when I have optional fields defined in the schema. Suppose field3 should only be sent when field1 contains a certain value. When field1 does not contain the required value, I don't want field3 or its separator to be sent. From what I've read, I though adding 'FS' to the field type would do the trick but it doesn't. What is the proper way to define an optional field?

thanks

field1 = 11
field2 = 22
field3 = 33
field4 = 44

For example when field1 contains '11' I want to send 11223344.
When field1 contains XX want to send XX2244

<?xml version="1.0" encoding="UTF-8"?>
<schema id='CW'>
 <field id="field1" type="A"   length="2" />
 <field id="field2" type="A"   length="2" />
 <field id="field3" type="AFS" length="2" />
 <field id="field4" type="A"   length="2" />
</schema>

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/be5b199d-2af0-4b7f-8002-b5035d96e4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] FSDMsg, how to handle optional fields?

Alejandro Revilla
You use field 1 as a key (you add the value `key='true'`)

In your case, you'd have something like:

<schema id='CW'>
  <field id='field1' type='A' key='true' />
</schema>

When field 1 contains the value '11', the FSDMsg will read the rest of the fields from a file with the schema 'CW11' and there you can define your field 2 and 3. 

When field 1 contains 'XX', the schema 'CWXX' will get loaded and there you can define the fields required for that particular message.

Hope this helps, sorry it's tricky


On Wed, Feb 8, 2017 at 2:14 PM, Dan MacLeod <[hidden email]> wrote:


Using the sample schema below, I'm trying to use a FSDMsg to send commands to an HSM. My problem comes when I have optional fields defined in the schema. Suppose field3 should only be sent when field1 contains a certain value. When field1 does not contain the required value, I don't want field3 or its separator to be sent. From what I've read, I though adding 'FS' to the field type would do the trick but it doesn't. What is the proper way to define an optional field?

thanks

field1 = 11
field2 = 22
field3 = 33
field4 = 44

For example when field1 contains '11' I want to send 11223344.
When field1 contains XX want to send XX2244

<?xml version="1.0" encoding="UTF-8"?>
<schema id='CW'>
 <field id="field1" type="A"   length="2" />
 <field id="field2" type="A"   length="2" />
 <field id="field3" type="AFS" length="2" />
 <field id="field4" type="A"   length="2" />
</schema>

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/be5b199d-2af0-4b7f-8002-b5035d96e4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dke%3Dk3gqf%3DyRfOkjrB8Qtu_kg_TX4MiSqQKw3%3DUhcd-Ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] FSDMsg, how to handle optional fields?

Dan MacLeod
Thanks, Is it possible to use two fields as one single key? For example: if field1 = '11' and field2 = '22', would JPos look for a schema called CW1122?
<schema id='CW'>
  <field id='field1' type='A' key='true' />
  <field id='field2' type='A' key='true' />
</schema>

Dan MacLeod
7222 Windy Preserve
Lake Worth, FL 33467
(561) 670-1088

On Wed, Feb 8, 2017 at 1:34 PM, Alejandro Revilla <[hidden email]> wrote:
You use field 1 as a key (you add the value `key='true'`)

In your case, you'd have something like:

<schema id='CW'>
  <field id='field1' type='A' key='true' />
</schema>

When field 1 contains the value '11', the FSDMsg will read the rest of the fields from a file with the schema 'CW11' and there you can define your field 2 and 3. 

When field 1 contains 'XX', the schema 'CWXX' will get loaded and there you can define the fields required for that particular message.

Hope this helps, sorry it's tricky


On Wed, Feb 8, 2017 at 2:14 PM, Dan MacLeod <[hidden email]> wrote:


Using the sample schema below, I'm trying to use a FSDMsg to send commands to an HSM. My problem comes when I have optional fields defined in the schema. Suppose field3 should only be sent when field1 contains a certain value. When field1 does not contain the required value, I don't want field3 or its separator to be sent. From what I've read, I though adding 'FS' to the field type would do the trick but it doesn't. What is the proper way to define an optional field?

thanks

field1 = 11
field2 = 22
field3 = 33
field4 = 44

For example when field1 contains '11' I want to send 11223344.
When field1 contains XX want to send XX2244

<?xml version="1.0" encoding="UTF-8"?>
<schema id='CW'>
 <field id="field1" type="A"   length="2" />
 <field id="field2" type="A"   length="2" />
 <field id="field3" type="AFS" length="2" />
 <field id="field4" type="A"   length="2" />
</schema>

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/be5b199d-2af0-4b7f-8002-b5035d96e4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/RnGceVAeqMI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dke%3Dk3gqf%3DyRfOkjrB8Qtu_kg_TX4MiSqQKw3%3DUhcd-Ug%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CADXrcgZK9%3DLkR35-K%3Ds7yShvTs5eYzrNwqu%2BfMkDf%3DMbsc1-TQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [jpos-users] FSDMsg, how to handle optional fields?

Alejandro Revilla
Sure, that's how it works. 

You can have as many key fields as you want. 


On Wed, 8 Feb 2017 at 15:48, Dan MacLeod <[hidden email]> wrote:
Thanks, Is it possible to use two fields as one single key? For example: if field1 = '11' and field2 = '22', would JPos look for a schema called CW1122?
<schema id='CW'>
  <field id='field1' type='A' key='true' />
  <field id='field2' type='A' key='true' />
</schema>

Dan MacLeod
7222 Windy Preserve
Lake Worth, FL 33467
(561) 670-1088

On Wed, Feb 8, 2017 at 1:34 PM, Alejandro Revilla <[hidden email]> wrote:
You use field 1 as a key (you add the value `key='true'`)

In your case, you'd have something like:

<schema id='CW'>
  <field id='field1' type='A' key='true' />
</schema>

When field 1 contains the value '11', the FSDMsg will read the rest of the fields from a file with the schema 'CW11' and there you can define your field 2 and 3. 

When field 1 contains 'XX', the schema 'CWXX' will get loaded and there you can define the fields required for that particular message.

Hope this helps, sorry it's tricky


On Wed, Feb 8, 2017 at 2:14 PM, Dan MacLeod <[hidden email]> wrote:


Using the sample schema below, I'm trying to use a FSDMsg to send commands to an HSM. My problem comes when I have optional fields defined in the schema. Suppose field3 should only be sent when field1 contains a certain value. When field1 does not contain the required value, I don't want field3 or its separator to be sent. From what I've read, I though adding 'FS' to the field type would do the trick but it doesn't. What is the proper way to define an optional field?

thanks

field1 = 11
field2 = 22
field3 = 33
field4 = 44

For example when field1 contains '11' I want to send 11223344.
When field1 contains XX want to send XX2244

<?xml version="1.0" encoding="UTF-8"?>
<schema id='CW'>
 <field id="field1" type="A"   length="2" />
 <field id="field2" type="A"   length="2" />
 <field id="field3" type="AFS" length="2" />
 <field id="field4" type="A"   length="2" />
</schema>

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/be5b199d-2af0-4b7f-8002-b5035d96e4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/RnGceVAeqMI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].

To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CADXrcgZK9%3DLkR35-K%3Ds7yShvTs5eYzrNwqu%2BfMkDf%3DMbsc1-TQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: [hidden email]
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3DmMpunnaEHW3shN9TojS6i0xsxrS5Q0K_VtLso9EQANTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.