Get the Value from IntEdit to Init Dynamics ax

1.1k views Asked by At

How can I get the value from IntEdit to a Init on the datasource of a table, the IntEdit have Autodeclaration = yes, this is my code:

Int Var; 
Var = IntEditField.value(); //Doesn't work
Var = str2int(IntEditField.valueStr()); //Doesn't work
print Var;
1

There are 1 answers

0
Jan B. Kjeldsen On BEST ANSWER

The FormIntControl.value do return the int value of the control, so

Int var = IntEditField.value();

should work. It will return zero of cause if the control has not been set. Beware, on FormRealControl it is named realValue, on FormStringControl text, consistency sucks.

In older versions than AX 2012, you should place a semicolon after declarations like this:

Int var; 
;
var = IntEditField.value();

Also, after setting the AutoDeclaration property, always recompile the form otherwise run-time errors or wrong behavior occurs.

This and other similar questions indicates you are not accustomed to using bound controls or edit methods.