baseConv function in the Factory
The baseConv function converts a base 10 integer, or a string that corresponds to an integer, to a different base. Optional parameters allow the user to apply a 2-complement code (if set to True) on the input and/or on the output value.
Parameters Parameter Description column The attribute to be converted. Its type must be numeral. The column parameter is mandatory. basein The column’s base. The basein parameter is mandatory. baseout The result’s base. The baseout parameter is mandatory. compflagin If it is False, or not specified, a 2-complement code is not applied to the original column, while if it is True, a 2-complement code is applied to the original column. compflagout If it is False, or not specified, a 2-complement code is not applied to the result, while if it is True, a 2-complement code is applied to the original column. Example The following example uses the MT functions dataset. Description Screenshot In this example, we want to change the base (base-10) of the Var_1 attribute’s values to base-2 values. In the Var_2 attribute, type the following formula: The values in Var_1 have been converted in binary form and are displayed in Var_2.baseConv(column, basein, baseout, compflagin, compflagout)
baseConv($"Var_1",10,2)