Custom Dependency on Decimal Field

Hi,

I have a `total_cost` that is a currency field. I need to create a custom dependency on other field based on this `total_cost` field. 

Consider there is a field `limit` that should be required/visible if the `total_cost` field is greater than 5000. 

array(
     'name' => 'SetRequired',
     'params' => array(
         'target' => 'limit',
         'value' => 'greaterThan($total_cost, 5000)',
      ),
),

I have created a custom dependency as above. Suppose if the `total_cost` field is null then this is not working out. How can I create a custom dependency for the currency field if it is null?

I have tried

'not(equal($total_cost, "NULL"))'

'not(equal($total_cost, NULL))'

Parents
  • André Lopes

    This is my dependency. Here instead of  `not(equal(strlen($total_cost), 0)))`  i tried 

    'not(equal($total_cost, "NULL"))'

    'not(equal($total_cost, NULL))'

    But still, the visibility is not working?

    $dependencies['My_module']['custom-dep'] = array(
        'hooks' => array("all"),
        'trigger' => 'true',
        'triggerFields' => array(
               'total_cost',
       ),
       'onload' => true,
       'actions' => array(
       array(
          'name' => 'SetRequired',
          'params' => array(
          'target' => 'limit',
          'value' => 'and(greaterThan($total_cost, 5000), not(equal(strlen($total_cost), 0)))',
          ),
       ),
       array(
          'name' => 'SetVisibility',
          'params' => array(
          'target' => 'limit',
          'value' => 'and(greaterThan($total_cost, 5000), not(equal(strlen($total_cost), 0)))',
          ),
       ),
    ),
    );

  • Your dependency metadata seems to be fine.

    We have dependencies pretty much similar to that "greaterThan($total_cost, 5000)" and only that formula is the enough to trigger it.

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply Children
No Data