FormDataSourceMarks Class [AX 2012]
The FormDataSourceMarks class makes it easy to remember all marked rows in a given data source.
| Method | Description | |
|---|---|---|
| cancelTimeOut | Cancels a previous method call to the setTimeOut method. (Inherited from Object.) |
| equal | Determines whether the specified object is equal to the current one. (Inherited from Object.) |
| getMarksFromDataSource | |
| getTimeOutTimerHandle | Returns the timer handle for the object. (Inherited from Object.) |
| handle | Retrieves the handle of the class of the object. (Inherited from Object.) |
| new | Initializes a new instance of the FormDataSourceMarks class. |
| notify | Releases the hold on an object that has called the wait method on this object. (Inherited from Object.) |
| notifyAll | Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.) |
| objectOnServer | Determines whether the object is on a server. (Inherited from Object.) |
| owner | Returns the instance that owns the object. (Inherited from Object.) |
| parmFormDataSource | Gets or sets the FormDataSource parameter. |
| setMarksOnDataSource | |
| setTimeOut | Sets up the scheduled execution of a specified method. (Inherited from Object.) |
| toString | Returns a string that represents the current object. (Inherited from Object.) |
| usageCount | Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.) |
| wait | Pauses a process. (Inherited from Object.) |
| xml | Returns an XML string that represents the current object. (Inherited from Object.) |
| ::construct | Initializes a new instance of the FormDataSourceMarks class. |
This example demonstrates the use of the FormDataSourceMarks class. However, this example will not compile in a job as it must be run in the context of another class, a form, or other object.
public void run()
{
// Split transactions into the number of lines specified in "projQty".
FormDataSource formDataSource;
TmpProjAdjustment localTmpProjAdjustment;
FormDataSourceMarks formDataSourceMarks;
formDataSource tmpProjAdjustmentDS;
ProjQty projQty;
TmpProjAdjustment tmpProjAdjustment;
try
{
if (!projQty && (tmpProjAdjustment.qty != 0 &&
(tmpProjAdjustment.adjustmentType != ProjAdjustmentType::Revenue)))
{
throw error(strFmt("@SYS56447", tmpProjAdjustment.qty));
}
ttsbegin;
if (args && args.dataset() == tablenum(TmpProjAdjustment) &&
args.record().dataSource())
{
formDataSource = args.record().dataSource();
localTmpProjAdjustment.data(formDataSource.cursor());
if (formDataSource.anyMarked())
{
// Selection exists!
// Remember marks.
formDataSourceMarks = FormDataSourceMarks::construct();
formDataSourceMarks.parmFormDataSource(formDataSource);
formDataSourceMarks. getMarksFromDataSource();
// Traverse the datasource - delete and split.
for (tmpProjAdjustment=formDataSource.anyMarked() ?
formDataSource.getFirst(1) : args.record();
tmpProjAdjustment;
tmpProjAdjustment=formDataSource.getNext())
{
// Find the entry given by tmpProjAdjustment, to be able
// to update it.
if ( formDataSource.findRecord(tmpProjAdjustment) )
{
// Need this to be able to update tmpProjAdjustment.
tmpProjAdjustment = formDataSource.cursor();
this.deleteTransaction();
this.splitTransaction(tmpProjAdjustment);
}
}
tmpProjAdjustmentDS.executeQuery(); // No more marks.
// Mark up again.
formDataSourceMarks. getMarksFromDataSource();
}
else
{
// No selection.
// Need this to be able to update tmpProjAdjustment.
tmpProjAdjustment = formDataSource.cursor();
this.deleteTransaction();
this.splitTransaction(tmpProjAdjustment);
}
}
ttscommit;
}
catch (Exception::Deadlock)
{
retry;
}
catch (Exception::Error)
{
throw error("@SYS18447");
}
}
Community Additions
ADD
Show: