0
votes

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
Your question is not clear. Are you trying to assign the value of IntEditField when the form opens? IntEditField.value() should work. The table datasource on a form is initialized when the form is initialized. You can assign by doing IntEditField.value(5); - Alex Kwitny
Hi @AlexKwitny, Thank you for answer.. I need to get the value of a IntEditField on a Init of a Table - Paul Noris
You need to provide more code. When does the table init occur in your scenario? If it's a form object, you need to pass it to the table's init method generally. - Alex Kwitny

1 Answers

2
votes

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.