FormMethods:-
form --init method -- you will not get any cursor record in the form init level.
1. Get the Cursor record at the DataSource level.
internal final class DAXSalesTable_Extension
{
boolean validateWrite()
{
boolean ret;
FormRun fr = this.formRun();
FormDataSource FDS = fr.dataSource();
SalesTable salestableloc = FDS.cursor();
ret = next validateWrite();
return ret;
}
}
-----------------------------------------------
2. Get the cursor record in Datasourcefield level:-
[ExtensionOf(formDataFieldStr(SalesTable,SalesTable,CustAccount))]
internal final class DAXSalesTableDatasourceField_Extension
{
public void modified()
{
SalesTable salesTable;
FormDataSource fds;
FormDataObject fd = any2Object(this) as FormDataObject;// This line of code works at both the control level and the form data field level.
next Modified();
fds = fd.datasource();
salesTable = fds.cursor();
}
}
---------------------------------------------------
3. Get the cursor record in the Control level:-
[ExtensionOf(formControlStr(SalesTable,SalesStatus))]
internal final class DAXSalesTableControl_Extension
{
public void clicked()
{
next clicked();
FormControl callerButton = any2Object(this) as FormControl;
FormRun formRun = callerButton.formRun();
FormDataSource formDataSource = formRun.datasource();
CustTableChangeProposal custTableChangeProposal = formDataSource.cursor();
}
}
get control:-
FormRun formRun = this as FormRun;
FormButtonControl DAXTeamButton = formRun.design().controlName(formControlStr(CustChangeProposal, DAXTeamButton)) as FormButtonControl;
---------------------------------------------------
Form on activated:-
How to get FormControl in OnActivated method:-
internal final class Class1
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormEventHandler(formStr(EcoResProductDetailsExtended), FormEventType::Activated)]
public static void EcoResProductDetailsExtended_OnActivated(xFormRun sender, FormEventArgs e)
{
FormControl ctrlname = sender.design().controlName(formControlStr(EcoResProductDetailsExtended,"USMFButton"));
FormDataSource FDS=sender.dataSource(formDataSourceStr(EcoResProductDetailsExtended, InventTable));
InventTable _table =FDS.cursor() ;
if(curExt()=="USMF") // Condition
{
ctrlname.enabled(true);
}
else
{
ctrlname.enabled(false);
}
}
}
// PurchTable callerRec = sender.formRun().dataSource("PurchTable").cursor();
----------------------------------------------------------------------------------------
No comments:
Post a Comment