SELECT percent_complete, start_time, status, command, estimated_completion_time, cpu_time, total_elapsed_time
FROM sys.dm_exec_requests
This is my blog for storing and sharing my programming knowledge with all other programmers
SELECT percent_complete, start_time, status, command, estimated_completion_time, cpu_time, total_elapsed_time
FROM sys.dm_exec_requests
//Set the dimesnion
public static RecId setDimension(RecId _recID,str _DimName,str _DimValue)
{
DimensionAttributeValue dimAttrValue;
DimensionAttribute dimAttr;
DimensionAttributeValueSetStorage davss;
RecId defaultDimension;
davss = DimensionAttributeValueSetStorage::find(_recID);
dimAttr = DimensionAttribute::findByName(_DimName);
dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, _DimValue, false, true);
if(dimAttrValue)
{
davss.addItem(dimAttrValue);
defaultDimension = davss.save();
}
return defaultDimension;
}
//edit method
[SysClientCacheDataMethodAttribute(true)]
static edit DimensionValue DepartmentMethod(InventJournalTrans _InventJournalTrans,boolean _set,DimensionValue _DimensionValue)
{
DimensionAttribute dimensionAttribute;
DimensionAttributeValueSetItem valueSetItem;
DimensionAttributeValue dimAttrValue;
DimensionAttribute dimAttr;
DimensionFinancialTag _DimensionFinancialTag;
DimensionAttributeDirCategory dimAttributeDirCategory;
DimensionEntryControl _DimensionEntryControl;
dimensionAttribute = DimensionAttribute::findByName("Department");
if(_set)
{
_InventJournalTrans.DefaultDimension = InventJournalMovement_Extension::setDimension(_InventJournalTrans.DefaultDimension,"Department",_DimensionValue);
}
select * from valueSetItem
where valueSetItem.DimensionAttributeValueSet == _InventJournalTrans.DefaultDimension
join DimensionAttribute, EntityInstance, RecId, HashKey, IsSuspended, ActiveFrom, ActiveTo from dimAttrValue
where dimAttrValue.RecId == valueSetItem.DimensionAttributeValue &&
dimAttrValue.IsDeleted == false
&& dimAttrValue.DimensionAttribute==dimensionAttribute.RecId
join * from dimAttr
where dimAttr.RecId == dimAttrValue.DimensionAttribute
;
return valueSetItem.DisplayValue;
}
//Lookup
[FormControlEventHandler(formControlStr(InventJournalCount, DepartmentMethod), FormControlEventType::Lookup)]
public static void DepartmentMethod_OnLookup(FormControl sender, FormControlEventArgs e)
{
DimensionAttribute dimensionAttribute;
DimensionAttributeDirCategory dimAttributeDirCategory;
Query query = new Query();
SysTableLookup sysTableLookup;
dimensionAttribute = DimensionAttribute::findByName("Department");//Department//Purpose
if (dimensionAttribute.Type == DimensionAttributeType::CustomList)
{
select firstonly DirCategory from dimAttributeDirCategory where dimAttributeDirCategory.DimensionAttribute == dimensionAttribute.RecId;
sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionFinancialTag), sender);
// Add name field to be shown in the lookup form.
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value));
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
//sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, RecId));
query = new Query();
query.addDataSource(tableNum(DimensionFinancialTag)).addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory)).value(queryValue(dimAttributeDirCategory.DirCategory));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}
MyTable.RESET;
MyTable.SETCURRENTKEY(Field1,Field2,Field3);var docuRef_Notes = formRun.design().controlName(formControlStr(DocuView, docuRef_Notes)) as FormStringControl;
1. Form dataSource event handler: Here I will be using the vendTable form to get table buffer and perform additional business logic or validation.
Vendtable = Form name
vendTable = form data source name
[FormDataSourceEventHandler(formDataSourceStr(Vendtable, vendTable), FormDataSourceEventType::Written)]
public static void vendTable_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun form = sender.formRun();
FormDataSource vendTable_ds = form.dataSource(formDataSourceStr(Vendtable,Vendtable)) as FormDataSource;
Vendtable Vendtable= vendTable_ds.cursor();
<Now to got table buffer, perform business logic/validation>
}
lets see one more example below;
2. Form DataSource while closing the form (same will apply for OnInitialized,
[FormEventHandler(formStr(EcoResAttributeValue), FormEventType::Closing)]
public static void EcoResAttributeValue_OnClosing(xFormRun sender, FormEventArgs e)
{
FormDataSource ecoResProduct_ds = sender.dataSource(formDataSourceStr(EcoResAttributeValue, EcoResProductAttributeValue));
EcoResProductAttributeValue ecoResAttributeValue = ecoResProduct_ds.cursor();
<YOUR CODE>
}
3. Post-event hander of Form init or any other standard method method
[[PostHandlerFor(formStr(Ledger), formMethodStr(Ledger, init))]
public static void Ledger_Post_init(XppPrePostArgs _args)
{
#ISOCountryRegionCodes
FormRun form = _args.getThis();
FormDesign design = form.design();
FormControl revaluationAccount = design.controlName(formControlStr(Ledger, revaluationAccount));
FormControl currencyRevaluation = design.controlName(formControlStr(Ledger, currencyRevaluation));
<your code>
}
4. Form control event hander:
[FormControlEventHandler(formControlStr(LogisticsPostalAddress, Roles), FormControlEventType::Modified)]
public static void Roles_OnModified(FormControl sender, FormControlEventArgs e)
{
FormRun element = sender.formRun();
FormControl purposeCtrl = element.design().controlName(formControlStr(LogisticsPostalAddress, Roles));
FormDataSource logisticsLocation_DS = element.dataSource(formDataSourceStr(LogisticsPostalAddress, LogisticsLocation));
<business logic>
}
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | void cancelPickingRoute() { WMSPickingRoute WMSPickingRoute = WMSPickingRoute::findBySalesId("SO024406"); WMSPickingLineCancel WMSPickingLineCancel; WMSOrderTrans WMSOrderTrans; WMSOrderTransUnPick WMSOrderTransUnPick; ; switch (WMSPickingRoute.expeditionStatus) { case WMSExpeditionStatus::Complete : while select forupdate WMSOrderTrans index hint OrderIdx where WMSOrderTrans.fullPallet == 0 && WMSOrderTrans.routeId == WMSPickingRoute.pickingRouteID { ttsbegin; WMSOrderTransUnPick::newWMSOrderTrans(WMSOrderTrans).unPick(WMSOrderTrans.qty); ttscommit; } while select WMSOrderTrans index hint OrderIdx where WMSOrderTrans.fullPallet == 0 && WMSOrderTrans.routeId == WMSPickingRoute.pickingRouteID { |