// 1) 统一设置表单模式与当前主记录 varAppt
If(
// —— New 模式:没有 ctxActivityId
Coalesce(ctxMode, "") = "New" || IsBlank(ctxActivityId),
/* New */
NewForm(frmPlan);
Set(varAppt, Blank());
,
/* Edit */
EditForm(frmPlan);
Set(varAppt, LookUp(Appointment, activityid = ctxActivityId))
);
// 2) 准备「活動種別(大項目)」默认集合:
// Edit:从交叉表映射到大項目记录;New:设为空集合
If(
frmPlan.Mode = FormMode.Edit,
ClearCollect(
colMajorSelected,
ForAll(
Filter(
'活動種別(大項目)x活動明細',
appointmentid = varAppt.activityid
),
LookUp('活動種別(大項目)', majorid = ThisRecord.majorid)
)
),
// New 模式
Clear(colMajorSelected)
);
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme