Hi,
how do i modify the value of a form field in X++?
I found SetValue() method but doesnt seem to work out.
Is there a .value property which can be set in order to change the value of a field at runtime?
Thank you in advance
regards
Hi,
how do i modify the value of a form field in X++?
I found SetValue() method but doesnt seem to work out.
Is there a .value property which can be set in order to change the value of a field at runtime?
Thank you in advance
regards
You can modify the value in the form control by using the .text() method. (The control have to be the AutoDeclaration property set to Yes).
or you can try
Table.field = XX;
element.redraw(); //to refresh the form
FormStringControl strResult;
strResult = element.design().control(element.controlId("strResult"));
strResult.text("this is what it should say");
In this case the usual way is to set form control values in the super() method of the form, after the super() sentence.
Note that this shouldn't be appliable to controls related to datasource data.
Can you be more specific? What do you want to do? What is the problem?
what method I need to set value while opening form
hey,
try to save it direkt to the table.
eg.
inventTable.field = value
inventTable_ds.refresh()
Ok, the easiest way to do so is:
1.- Set the Autodeclaration property of the control to Yes.
2.- Now, to set the value in X++, put the name of the control, and the proper method (varies based on the basic data type of the control).
Examples:
StringEdit.text("Hello");
RealEdit.realValue(4.5);
IntEdit.value(5);
ComboBox.selection(2);
Form controls. More exactly i'm trying to set a text field's value.
Are you speaking about dialog controls, or form controls?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,246 Super User 2024 Season 2
Martin Dráb 228,041 Super User 2024 Season 2
nmaenpaa 101,148