What decided what datasource is passed in args from a form by default.

I have a form setup with 2 datasources, projtable, and a custom table called proptable. I’ve set the design and each item group to have proptable as the datasource. However the args passed to the formpart I’ve added are defaulting to be projtable.There is only one field in the form that uses projtable as the datasource.

What decides the default datasource used in the args?


Can u be clear with the requirment …?

Please give the whole detail of your question then i shall able to suggest the solution.

I expect that the first datasource (= with lowest ID) is used - but why to care? Just set the DataSource property on the formpart explicitly.

The full problem is this. The 2 tables I have added are called proptable and propunit table. If a project is created in certain project groups an additional record is automatically created in proptable to store details of an associated property. If a subproject is created for one of these projects a record is automatically created in the propunittable to store details of the property sub unit.

The form I’m working on is launched from a list page of the properties and shows details of a specific property. The form part on this form lists any subunits associated with this property in a grid which can then be clicked to display details of the subunit in another form. This formpart is not behaving correctly as the main form is sending a projtable record in the args to this form on launch.

The only element on the main form using projtable as its datasource is one text field which displays the project name, I’ve set everything else to proptable and the name text element is at the same level in the design as around 12 other fields using proptable as the datasource. What I was wondering is how AX decided which type of record is passed in args as a default as I would then be able to resolve this through the properties of the form.

If this can’t be done that’s fine as I should be able to override this to pass a proptable record in args instead but I’m unsure which method I’d override to do this as this will be my first time overriding the args passed to a form part. Previously I’ve only overridden the args sent when launching another form and have done this at the time of the user interaction that launches the other form.

So you launch a form from another form, but the parent form sends different datasource than you want?

If the form is called via a menu item button, simply use its DataSource property. If it’s called from code, set the value there (to args.record()).

No, as I said, its the args passed from the form to the formpart that are incorrect. I understand how to change the datasource used when I launch a form through a user interaction but as formparts are launched automatically at launch I was unsure what method would be overridden to be able to edit the args being passed to the form part.