AnsweredAssumed Answered

Clarification needed on len, size, precision in vardef for decimal

Question asked by Francesca Shiekh on Nov 16, 2016
Latest reply on Jan 18, 2017 by Francesca Shiekh

in vardefs a decimal has a length, size, and precision. 

How are the three related and what do they correspond to in the database definition?

if you have len and precision, wouldn't size be superfluous? or is size just a display parameter?

 

I am toying with different settings for len and precision in Studio, and manipulating vardefs.php by hand on a Custom module built via ModuleBuilder  to try to resolve a vardef mismatch that doesn't really exist.

 

/*COLUMNS*/
/*MISMATCH WITH DATABASE - reseller_discount - ROW [name] => 'reseller_discount' [type] => 'decimal' [len] => '5,2' [default] => '0.00' */
/* VARDEF - reseller_discount - ROW[required] => '' [name] => 'reseller_discount' [vname] => 'LBL_RESELLER_DISCOUNT' [type] => 'decimal' [massupdate] => '' [default] => '' [no_default] => '' [comments] => '' [help] => '' [importable] => 'true' [duplicate_merge] => 'enabled' [duplicate_merge_dom_value] => '1' [audited] => '1' [reportable] => '1' [unified_search] => '' [merge_filter] => 'disabled' [calculated] => '' [len] => '5,2' [size] => '10' [enable_range_search] => '' [precision] => '2' [dbType] => 'decimal' */
ALTER TABLE wcont_wolframcontractpdetails modify COLUMN reseller_discount decimal(5,2) DEFAULT 0 NULL ;

 

As you can see in the "MISMATCH WITH DATABASE" message above, the database has len = 5,2

From MySQL Workbench "desc wcont_wolframcontractpdetails" gives me:

 

# Field,                    Type,               Null,     Key,   Default,   Extra
'reseller_discount', 'decimal(5,2)', 'YES',    '',      '0.00',        ''

 

The VARDEF part of the message above shows len = 5,2

 

The ALTER TABLE statement shows decimal(5,2)

 

So where is the mismatch?

And why does this mismatch persist no matter how many times I execute that SQL?

 

from vardefs.php

  'reseller_discount' =>

  array (

    'required' => false,

    'name' => 'reseller_discount',

    'vname' => 'LBL_RESELLER_DISCOUNT',

    'type' => 'decimal',

    'massupdate' => false,

    'default' => '',

    'no_default' => false,

    'comments' => '',

    'help' => '',

    'importable' => 'true',

    'duplicate_merge' => 'enabled',

    'duplicate_merge_dom_value' => 1,

    'audited' => true,

    'reportable' => true,

    'unified_search' => false,

    'merge_filter' => 'disabled',

    'calculated' => false,

    'len' => 5,

    'size' => '10',

    'enable_range_search' => false,

    'precision' => 2,

  ),

 

There is no reference to reseller_discount in 

custom/modules/wcont_WolframContractPDetails/Ext/Vardefs

 

Outcomes