Hello,
I have a form and many tabs in it. In the general tab, I select primary asset type( reference group I mean lookup) and asset type(enum). I need to hide and display some of the tabs based on the selection of both primary asset types and asset types. I wrote a code for this (I use OnModified event to select Primary asset Type) and I can hide or display tabs based on the selection of primary asset type but I am not sure how do I add those code selections of asset types, too.
If someone can help me with this I would be really appreciated it.
[FormDataFieldEventHandler(formDataFieldStr(EntAssetObjectTable, FixedAsset, PrimaryAssetType), FormDataFieldEventType::Modified)]
public static void PrimaryAssetType_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
FormDataSource dataSource = sender.datasource();
EntAssetObjectTableFormDataFieldEvent::UpdateTab(dataSource);
}
///
///
///
///
///
[FormDataSourceEventHandler(formDataSourceStr(EntAssetObjectTable, FixedAsset), FormDataSourceEventType::Activated)]
public static void FixedAsset_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
EntAssetObjectTableFormDataFieldEvent::UpdateTab(sender);
}
public static void UpdateTab(FormDataSource sender)
{
FixedAsset fixedAsset = sender.cursor();
FormRun formRun = sender.formRun() as FormRun;
FormControl le = formRun.design().controlName(formControlStr(EntAssetObjectTable, TabA));
FormControl pg = formRun.design().controlName(formControlStr(EntAssetObjectTable, TabB));
FormControl c = formRun.design().controlName(formControlStr(EntAssetObjectTable, TabC));
FormControl d = formRun.design().controlName(formControlStr(EntAssetObjectTable, TabD));
FormControl e = formRun.design().controlName(formControlStr(EntAssetObjectTable, TabE));
a.visible(false);
e.visible(false);
c.visible(false);
b.visible(false);
e.visible(false);
var primary = PrimaryAssetType_WM::findByRecId(fixedAsset.PrimaryAssetType);
var type = FixedNonFixedSelectionBaseEnum_WM::NonFixedAssets;
switch(primary.Code)
{
case 'x':
a.visible(true);
break;
case 'y':
b.visible(true);
break;
case 'z':
c.visible(true);
d.visible(true);
break;
case 't':
e.visible(true);
a.visible(true);
break;
}
Thanks, regards...


Report
All responses (
Answers (