In form level datasource shall we display multiple records in grid.

In form level datasource shall we display multiple records in grid.

example - form A → datasource - salesLine

form A has Grid and column - ItemId

we get salesLine args record, through this salesLine args record - need to loop SalesLine to get all related salesLine records(If sales order has multiple lines)

how to assign all “salesLine” records to the form A grid

Thanks

You say that you want to show all sales lines related to the sales line that you get from Args, but what do you consider related? Do you want all lines belonging to the same order as the line from Args?

Yes , I need all the lines in sales order.

In form B>I have ds - salesLine

here I want to display all lines which my args have.

You simply have to filter the data source by SalesId of the line received from Args.

For example, implement linkActive() of SalesLine data source of Form A like this:

public void linkActive()
{
    SalesLine       salesLineArg;
    QueryBuildRange range;

    if (element.args().dataset() == tableNum(SalesLine))
    {
        salesLineArg = element.args().record();

        range = SysQuery::findOrCreateRange(this.queryBuildDataSource(),
                                            fieldNum(SalesLine, SalesId));                    
        range.value(queryValue(salesLineArg.SalesId));
    }

    super();
}