printing selected records on report

hello friends,
this is below that exactly i want to print report.
when i clicked on menu item button then selected records should be print on report. i.e. id 001 & 002

6663.my.JPG

Hello Pravin,

If the checkbox is table field then have a query as to fetch the data with checkbox == NoYes::Yes.
For example, let say - table is of TestTable and field CheckBoxfield, then build the query as below.

i.e
Query q;
QueryBuildRange qbds;
QueryBuildRange qbr;
QueryRun qr;

q = new Query();
qbds = q.datasourceTable(tablenum(TestTable));
qbr = qbds.addrange(fieldnum(testTable,CheckBoxField));
qbr.value(QueryValue(NoYes::Yes));

qr = new QueryRun(q);

while( qr.next())
{
testTable = qr.get(Tablenum(testTable));
}

hi…naresh

its not table checkbox field , its a checkbox control in form design.

Hi pravin,

method 1:

create a new table…(Duplicate the table which contains the above records…)

write below code in menuitembutton clicked() method… before super() so that data gets inserted before printing the report…

void clicked()

{

Student inventLocal;

;

//getFirst method gets all the selected records in the grid

inventLocal = Student_ds.getFirst(true);

while (inventLocal)

{

info(strfmt(“You selected Item %1”,inventLocal.Studentid));

//insert the record into temporary table…

// get the next selected record

inventLocal = Student_ds.getNext();

}
super();

}

Use the newly created table in the report…

delete all the records from the newly created table, whenever you click the menuitembutton…

method 2:

use containers …

void clicked()

{

Student inventLocal;

container c;

int i;

;

//getFirst method gets all the selected records in the grid

inventLocal = Student_ds.getFirst(true);

while (inventLocal)

{

i++;

info(strfmt(“You selected Item %1”,inventLocal.Studentid));

c = conins(c,i, inventLocal.recid);

// get the next selected record

inventLocal = Student_ds.getNext();

}
super();

}

after inserting the recids… fetch the container values from container in the fetch method…

to pass the container values from menuitembutton clicked() mthd to fetch() method convert

container to string… and then use args.parm();