尝试从 FormRun 检索数据源时获取 null
Get null when trying to retrieve datasource from FormRun
我有2个表格,我们称之为表格A和表格B。
在表单 A 中,我有一个按钮(空白按钮),当单击该按钮时,它将重定向到带有参数的表单 B,并且该参数将被注入表单 B 的数据源。我无法检索表单 B 的数据源,它总是returns 空。
[FormControlEventHandler(formControlStr(htVehicleListPage, FormCommandButtonControl1), FormControlEventType::Clicked)]
public static void FormCommandButtonControl1_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormDataSource htVehicleTable= sender.formRun().dataSource(formDataSourceStr(htVehicleListPage,htVehicleTable));
htVehicleTable record=htVehicleTable.cursor();
info(int2Str(record.htVehicleID)); //result: some legit ID.
Args argsObj=new Args();
argsObj.name(formStr(htVehicleMaintenanceDetails));
FormRun formRunObj=new FormRun(argsObj);
FormDataSource openningFormDataSource =formRunObj.dataSource(formDataSourceStr(htVehicleMaintenanceDetails,htVehicleMaintenance)); //result: openningFormDataSource is null, however, formRunObj is not null.
Query queryObj=new Query();
openningFormDataSource.query(queryObj);
QueryBuildDataSource queryBuildDataSourceObj=queryObj.addDataSource(tableNum(htVehicleMaintenance));
queryBuildDataSourceObj.addRange(fieldNum(htVehicleMaintenance,htVehicleID)).value(strFmt("htVehicleMaintenance.htVehicleID=%1",record.htVehicleID));
formRunObj.init();
formRunObj.run(); //if we inorge the null error it will show a form here
formRunObj.wait();
}
FormRun
就是...它是 运行 表单对象。您的 openningFormDataSource
将是 null,因为您在 formRunObj.init();
之前调用它并且表单还不是 运行。
它是 Form.init()
,然后是 Form...Datasource.init()
,然后基本上是 Form.run()
。
将你的 formRunObj.init()
调高,然后重试。
我有2个表格,我们称之为表格A和表格B。 在表单 A 中,我有一个按钮(空白按钮),当单击该按钮时,它将重定向到带有参数的表单 B,并且该参数将被注入表单 B 的数据源。我无法检索表单 B 的数据源,它总是returns 空。
[FormControlEventHandler(formControlStr(htVehicleListPage, FormCommandButtonControl1), FormControlEventType::Clicked)]
public static void FormCommandButtonControl1_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormDataSource htVehicleTable= sender.formRun().dataSource(formDataSourceStr(htVehicleListPage,htVehicleTable));
htVehicleTable record=htVehicleTable.cursor();
info(int2Str(record.htVehicleID)); //result: some legit ID.
Args argsObj=new Args();
argsObj.name(formStr(htVehicleMaintenanceDetails));
FormRun formRunObj=new FormRun(argsObj);
FormDataSource openningFormDataSource =formRunObj.dataSource(formDataSourceStr(htVehicleMaintenanceDetails,htVehicleMaintenance)); //result: openningFormDataSource is null, however, formRunObj is not null.
Query queryObj=new Query();
openningFormDataSource.query(queryObj);
QueryBuildDataSource queryBuildDataSourceObj=queryObj.addDataSource(tableNum(htVehicleMaintenance));
queryBuildDataSourceObj.addRange(fieldNum(htVehicleMaintenance,htVehicleID)).value(strFmt("htVehicleMaintenance.htVehicleID=%1",record.htVehicleID));
formRunObj.init();
formRunObj.run(); //if we inorge the null error it will show a form here
formRunObj.wait();
}
FormRun
就是...它是 运行 表单对象。您的 openningFormDataSource
将是 null,因为您在 formRunObj.init();
之前调用它并且表单还不是 运行。
它是 Form.init()
,然后是 Form...Datasource.init()
,然后基本上是 Form.run()
。
将你的 formRunObj.init()
调高,然后重试。