addDataField, only add select records from a temporary table

I am dynamically building a form through x++.

How do I add select records to a grid?

Something like the below statement but not every row of the table. Only rows where somefield == somevalue, for eg.

formBuildGridControl.addDataField(formBuildDatasource.id(), fieldNum(SomeTable, SomeField));

Hi Merlin,

Just Include the below code in your existing Code

FormDataSource fds;
QueryBuildDatasource Qbds;
QueryBuildRange Qbr;

;

.
.

formRun = classfactory.formRunClass(args);
formRun.init();
.
.
.
fds = formRun.dataSource();
Qbds = fds.query().dataSourceTable(TableNum(SomeTable));
Qbr = Qbds.addRange(fieldnum(SomeTable, SomeField));
Qbr.value(‘SomeVale’);
.
.
.
.
formRun.run();

Hi, thanks for the answer but it doesn’t seem to be the right way for my problem.

Cause I’ve got like multiple grids and I want each to be populated based on different query of a table/datasource. Am new so am not that sure, but it seems the above solution won’t work in this case?