Notifications
Announcements
No record found.
so i have one scenario, where I need to reflect all the fields of a table to another form which doesn't have any datasource and fields. It totally depend on the user. If he add x data values then x fields should be reflected to new form .
You can add the ds of the first form to the second form and play with the visible properties of the fields.
You can use TempTable and fill it based on the values in the First form.
Finally, you can add unbounded fields to the second form and fill it out according to the selections in the first form.
Hi thnks for your answer, but the fields are dynamic and also, the type of fields will vary according to the user preference-it can be text,number,checkbox or anything, so how can i play with the visibility of the fields
You can do it in two different ways;
Set the AoutoDecleration property of the relevant field in the form design to Yes.
fielName.visibale(false);//or fielName.visible(Table.Field1)
(or)
Table_ds.object(fieldNum(Table, Field1)).visible(false);
If it is clear which fields will be visible or not when the form is opened, it is most logical to write these codes in the form's init method
If the status of the fields will change while using the form, you can write it to active.
I got it little bit, but I want to tell the fields can be of any type. It can be text, number, dropdown,checkbox. eg. user has mentioned -
FieldName type length
A text 10
B check box NA
Now these fields should be reflected to the dynamic form with the type text and checkbox. User can change their name ,length ,type at any point of time.
I tried to implement the code - daxingdax.blogspot.com/.../create-fields-dynamically-on-form-ax.html in validatewrite of the ds of first form where we define the fields but wasn't successful.
Of course, you can create a form with code and run it in runtime, but I'm not sure if you really need such a thing. In the first form there is a table where you get the values from the user. Why not use the same table.
Also validateWrite is not a place where we would want to add this kind of code. If there is no very special situation, write it under a button as in the example.
Lastly, I can't see any serious errors in the example, but I have to try it to be sure (I may not have time during the day).
If you share with us the error you encounter while using it, we will try to help.
That table is still dynamic. I want to add the field according to the users preference. suppose the user want 3 text type fields then first i need to create 3 string data type fields. Still cant get it , how should i do it.
It's not exactly dynamic in the example you showed. There is a table and form in the background. Only the form has no design. It creates a new design with the fields of the table.
With a similar structure, you can add table-independent unbounded (without datasource and datafield value) controllers. You can assign an initial value. But in this case, it is not possible to have a grid-like structure. Each control can hold only one value.
Now this is an example- these fields can be infinite number. As soon as user saves the field, these fields should be reflected to other form according to their type. Hope you get it.
Below I have shared a code showing how to add unbounded fields to form design. I just added Int64 and string fields but other types can be added with similar logic. The field adding part can be converted into a method as in the other example, and you can send the type and orher values from the outside.
static void Dmr_ES_RunTimeFormDesign(Args _args) { Args args; Form form; FormRun formRun; FormBuildDesign formBuildDesign; FormBuildStringControl formBuildStringControl; FormBuildInt64Control formBuildInt64Control; FormBuildTabControl formBuildTabControl; FormBuildTabPageControl formBuildTabPageControl; ; // Create the form header. form = new Form(); // Create the form design. formBuildDesign = form.addDesign("Design"); formBuildDesign.caption("myForm"); // Add tabbed page controls, a grid control, and string controls. formBuildTabControl = formBuildDesign.addControl(FormControlType::Tab, "Overview"); formBuildTabPageControl = formBuildTabControl.addControl(FormControlType::TabPage,"Details"); formBuildTabPageControl.caption("Details"); formBuildInt64Control = formBuildTabPageControl.addControl(FormControlType::Int64, "MyInt64UnboundedField"); formBuildInt64Control.label("MyInt64UnboundedField"); formBuildInt64Control.helpText("MyInt64UnboundedField"); formBuildInt64Control.allowEdit(true); formBuildInt64Control.value(1234); formBuildStringControl = formBuildTabPageControl.addControl(FormControlType::String, "MyStringUnboundedField"); formBuildStringControl.label("MyStringUnboundedField"); formBuildStringControl.helpText("MyStringUnboundedField"); formBuildStringControl.allowEdit(true); formBuildStringControl.text("My string Value"); args = new Args(); args.object(form); // Create the run-time form. formRun = classfactory.formRunClass(args); formRun.run(); formRun.detach(); }
thanks for the code, but by this are we not creating the new form via code?/
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 592 Most Valuable Professional
André Arnaud de Cal... 478 Super User 2025 Season 2
BillurSamdancioglu 305 Most Valuable Professional