Hi
I created job to run form “PurchTable” , but it retun just the first record
static void OpenFormByCodeB()
{
FormRun formRun;
Args args = new Args();
PurchTable _PurchTable;
;
Select _PurchTable where _PurchTable.ProjID == “PRJ_000006”;
args.name(formstr(PurchTable));
args.record(_PurchTable);
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.detach();
}
Ths .
Hello,
Your code is executing correctly, it will show the selected record in the PurchTable form as you are passing the selected record to the args object . If you will remove the following code line:
args.record(_PurchTable);
then you’ll see all the records in the PurchTable form.
hi,
But i want to show just the records with ProjID = PRJ_000006.
Hello,
For doing this you’ll have to make use of FormDataSource class and the filter method available for this class. You can use the below code:
static void OpenFormByCode()
{
Args args = new Args(formstr(PurchTable));
FormRun formRun;
FormDataSource formDataSource = new FormDataSource();
;
formRun = ClassFactory.formRunClass(args);
formRun.init();
formDataSource = formRun.dataSource();
formRun.run();
formDataSource.filter(fieldNum(PurchTable, ProjId), “PRJ_000006”);
formRun.detach();
}
Fredke
September 26, 2011, 11:08am
6
Hi, I also used this code. But i have another question. What if i want to filter more than one field.
So i want to filter on the purchpoolid and the Purchplacer.
For example: the purchpoolid is “X” and the Purchplacer is curUserid()
Thank you in advance.