ulisses
ulisses

Reputation: 1581

How to cycle the filling of Form controls?

In my form I have three StringEdit controls.

I have to fill each Control with values. Is it possible to use while select for all these controls and to fill them?

I have this code:

StringEdit1.text(strFmt("value"));
StringEdit2.text(strFmt("value"));
StringEdit3.text(strFmt("value"));

But I would not like to repeat the code for each Control.

Is it possible, to use a code that looks like the one for the Record , something like:

getNext(), getFirst(), etc.

This filling action should start in the form's init method.

Thanks for your time,

Enjoy

Upvotes: 0

Views: 95

Answers (1)

Alex Kwitny
Alex Kwitny

Reputation: 11544

I wrote this post that should help you loop over form controls.

The post specifically does recursion to drill down into each group, etc. You can use the same logic though if all of your controls are on one group and just remove the recursion.

http://alexondax.blogspot.com/2014/05/how-to-use-recursion-to-loop-over-form.html

Just copy & paste the code into a job and run it (AX12/AX09) and it's pretty cool.

Upvotes: 1

Related Questions