gpt4 book ai didi

axapta - 尝试从 FormRun 检索数据源时获取 null

转载 作者:行者123 更新时间:2023-12-02 05:48:52 27 4
gpt4 key购买 nike

我有 2 个表单,我们称之为表单 A 和 B。在表单A中,我有一个按钮(空白按钮),当单击该按钮时,它将重定向到带有参数的表单B,并且该参数将被注入(inject)到表单B的数据源中。我无法检索表单B的数据源,它总是返回 null。

[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() 移高一点,然后重试。

关于axapta - 尝试从 FormRun 检索数据源时获取 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51717962/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com