passing the number of records that are selected in the grid to another form control:
First of all create a new form "GridLinesCounter".
After that add the intedit control in that form Design and change the property auto declaration to yes.
Create a new menu item and add this form to that menu item.
Go to the sales table list page form and add the created menu item in the ActionPane.
Then override the clicked method in that menu item botton.
void clicked()
{
FormDataSource fds;
Common common;
int counter;
Args args;
FormRun formrun;
;
//super();
args = new Args();
fdS = SalesTable_ds;
for (common = fdS.getFirst(true) ? fdS.getFirst(true) : SalesTable_ds.cursor(); common; common = fdS.getNext())
{
counter++;
}
args.parm(int2str(counter));
args.name(formstr(gridlinescounter));
formRun = classFactory.formRunClass(Args);
formRun.init();
formrun.run();
formrun.wait();
info(int2str(counter));
}
Open the "GridLinesCounter" form and add init method.
public void init()
{
str counter;
counter = element.args().parm();
super();
intedit.value(str2int(Counter));
}
-----------------------------------------------------------------
Another code to get the same result .
void clicked()
{
int recordsCount;
HcmPosition hcmPosition1;
container con;
Args args;
str multiSelectString;
FormRun formrun;
args = new Args();
// gets the total records selected
recordsCount = HcmPosition_ds.recordsMarked().lastIndex();
hcmPosition1= HcmPosition_ds.getFirst(1);
while(hcmPosition1)
{
// storing recid of selected record in container
con = conIns(con,1, hcmPosition1.RecId);
// converting container to string with comma separated
multiSelectString = con2Str(con,',');
hcmPosition1= HcmPosition_ds.getNext(); // moves to next record
}
// passing string
args.parm(multiSelectString);
args.name(formstr(CH_RecrutmentForm));
formRun = classFactory.formRunClass(Args);
formRun.init();
formrun.run();
formrun.wait();
}
public void init()
{
container con;
int i;
str multipleRecords;
int record;
super();
// getting string value from caller
multipleRecords = element.args().parm();
// string to container
con = str2con(multipleRecords,",");
for(i = 1;i<= conLen(con) ;i++)
{
intedit.value(i);
}
}
First of all create a new form "GridLinesCounter".
After that add the intedit control in that form Design and change the property auto declaration to yes.
Create a new menu item and add this form to that menu item.
Go to the sales table list page form and add the created menu item in the ActionPane.
Then override the clicked method in that menu item botton.
void clicked()
{
FormDataSource fds;
Common common;
int counter;
Args args;
FormRun formrun;
;
//super();
args = new Args();
fdS = SalesTable_ds;
for (common = fdS.getFirst(true) ? fdS.getFirst(true) : SalesTable_ds.cursor(); common; common = fdS.getNext())
{
counter++;
}
args.parm(int2str(counter));
args.name(formstr(gridlinescounter));
formRun = classFactory.formRunClass(Args);
formRun.init();
formrun.run();
formrun.wait();
info(int2str(counter));
}
Open the "GridLinesCounter" form and add init method.
public void init()
{
str counter;
counter = element.args().parm();
super();
intedit.value(str2int(Counter));
}
Now,go to salestablelistpage form and select some records .
Then click newmenuitem button (gridlinescounter) then a form will be opened showing the no of records selected.
-----------------------------------------------------------------
Another code to get the same result .
void clicked()
{
int recordsCount;
HcmPosition hcmPosition1;
container con;
Args args;
str multiSelectString;
FormRun formrun;
args = new Args();
// gets the total records selected
recordsCount = HcmPosition_ds.recordsMarked().lastIndex();
hcmPosition1= HcmPosition_ds.getFirst(1);
while(hcmPosition1)
{
// storing recid of selected record in container
con = conIns(con,1, hcmPosition1.RecId);
// converting container to string with comma separated
multiSelectString = con2Str(con,',');
hcmPosition1= HcmPosition_ds.getNext(); // moves to next record
}
// passing string
args.parm(multiSelectString);
args.name(formstr(CH_RecrutmentForm));
formRun = classFactory.formRunClass(Args);
formRun.init();
formrun.run();
formrun.wait();
}
public void init()
{
container con;
int i;
str multipleRecords;
int record;
super();
// getting string value from caller
multipleRecords = element.args().parm();
// string to container
con = str2con(multipleRecords,",");
for(i = 1;i<= conLen(con) ;i++)
{
intedit.value(i);
}
}
No comments:
Post a Comment