# Numeric\_t.constValue and stateRule to clear fields

**URL:** <https://forum.fixtrading.org/t/numeric-t-constvalue-and-staterule-to-clear-fields/1578>\
**Category:** General Q&A\
**Tags:** algorithmic-trading, xid\_169212, imported\
**Created:** [August 10, 2009, 8:23pm UTC](https://forum.fixtrading.org/t/numeric-t-constvalue-and-staterule-to-clear-fields/1578 "2009-08-10T20:23:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fplpo\_x](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@fplpo\_x](https://forum.fixtrading.org/u/fplpo_x)\
**Post date:** [August 10, 2009, 8:23pm UTC](https://forum.fixtrading.org/t/numeric-t-constvalue-and-staterule-to-clear-fields/1578/1 "2009-08-10T20:23:22Z")

</div>

Imported from previous forum

---

<div class="post-metadata">

**Author:** ![fplpo\_x](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@fplpo\_x](https://forum.fixtrading.org/u/fplpo_x)\
**Post date:** [August 10, 2009, 8:23pm UTC](https://forum.fixtrading.org/t/numeric-t-constvalue-and-staterule-to-clear-fields/1578/2 "2009-08-10T20:23:22Z")

</div>

[original email was from Dev Ashish - [dashish@lab49.com](mailto:dashish@lab49.com) ]  
2 questions:

1. Numeric\_t is the only parameter type which seems to be missing const and constValue attributes. Any particular reasons for this?

2. What are the thoughts around how the UI is supposed to clear fields that may be used in stateRules and strategyEdit? For example, the sample OPLX strategy defines the following:

\<flow:StateRule value="0"\>  
\<val:Edit field="Posting" operator="EQ" value="e\_NOPOST"/\>  
\</flow:StateRule\>

\<val:StrategyEdit errorMessage="DisplaySize does not match Posting selection"\>  
\<val:Edit logicOperator="OR"\>  
\<val:Edit logicOperator="AND"\>  
\<val:Edit field="Posting" operator="EQ" value="e\_SMART"/\>  
\<val:Edit field="DisplaySize" operator="NX"/\>  
\</val:Edit\>  
\<val:Edit logicOperator="AND"\>  
\<val:Edit field="Posting" operator="EQ" value="e\_NOPOST"/\>  
\<val:Edit field="DisplaySize" operator="EQ" value="0"/\>  
\</val:Edit\>  
\<val:Edit logicOperator="AND"\>  
\<val:Edit field="Posting" operator="EQ" value="e\_Custom"/\>  
\<val:Edit field="DisplaySize" operator="EX"/\>  
\</val:Edit\>  
\</val:Edit\>  
\</val:StrategyEdit\>

if the user selected e\_NOPOST and then changed the value, the control with the stateRule will fail the validation since it didn’t get reset to NULL. In order to correctly handle this without writing special code, I had to add another stateRule (which looks hacky to me).

\<flow:StateRule value=""\>  
\<val:Edit field="Posting" operator="NE" value="e\_NOPOST"/\>  
\</flow:StateRule\>

---

<div class="post-metadata">

**Author:** ![gmal\_x](https://avatars.discourse-cdn.com/v4/letter/g/87869e/32.png) [@gmal\_x](https://forum.fixtrading.org/u/gmal_x)\
**Post date:** [August 10, 2009, 10:00pm UTC](https://forum.fixtrading.org/t/numeric-t-constvalue-and-staterule-to-clear-fields/1578/3 "2009-08-10T22:00:47Z")

</div>

For question 1: Numeric\_t should be treated as a virtual parameter just like Parameter\_t. Only types that correspond to valid FIX types (see tag 959) will have the attributes you listed.

---

<div class="post-metadata">

**Author:** ![gmal\_x](https://avatars.discourse-cdn.com/v4/letter/g/87869e/32.png) [@gmal\_x](https://forum.fixtrading.org/u/gmal_x)\
**Post date:** [August 10, 2009, 10:13pm UTC](https://forum.fixtrading.org/t/numeric-t-constvalue-and-staterule-to-clear-fields/1578/4 "2009-08-10T22:13:26Z")

</div>

For question 2:  
This is a very interesting problem… A stateRule can change the value of three attributes: visible, enabled and value. Of these three, stateRule.value is the only one that is not binary. Ie. stateRule.value can be given any value. So when we wish to determine when a control should be visible or enabled (not greyed-out) it is easy to do so by defining just one stateRule. But to set the value of a control it may require a few more stateRules which, as you pointed out, seems to be a bit of a kluge.  
I’m just stating this so that the terms have been defined. I think this needs some discussion followed by some direction by the WG.
