Axapta · Fără categorie

FilterCompilerOutputByTeam


static void FilterCompilerOutputByTeam(Args _args)
{
str                         filter          = SysVersionControlSystemSourceDepot::getOwner(‘Sys’);
Map                         prefixTeamMap   = infolog.globalCache().get(‘SysVersionControlSystemSourceDepot::getOwner’, 0, null);
Set                         set             = prefixTeamMap.valueSet();
SetEnumerator               enum            = set.getEnumerator();
syscompileroutput           sco             = infolog.compilerOutput();
tmpcompileroutput           op              = sco.compilerOutput();
Dialog                      dialog          = new Dialog(„Filter compiler output”);
dialogField                 dialogField     = dialog.addField(typeId(ABC), „Team”);
int                         i;
Map                         valueMap        = new Map(Types::Integer, Types::String);
FormBuildComboBoxControl    formComboBoxControl;
;
formComboBoxControl = dialogField.control();
formComboBoxControl.enumType(0);
formComboBoxControl.items(set.elements());

while (enum.moveNext())
{
i++;
formComboBoxControl.item(i);
formComboBoxControl.text(enum.current());
valueMap.insert(i, enum.current());
}

if (dialog.run())
{
startlengthyoperation();
filter = valueMap.lookup(dialogField.value()+1);
sco.startBPCheckContext();
sco.startBPCheck(‘xxx’);
while select op
{
if (SysVersionControlSystemSourceDepot::getOwner(op.SysUtilElementName) != filter)
op.delete();
}
sco.endBPCheckContext();
treenode::findNode(‘jobs\\’ + funcname()).AOTcompile();
}
}

Fără categorie

Change language in AX 2012 – No restart client


change language docx

 

void clicked()
{
LanguageId languageId;
xInfo info;
xNavPane xNavPane ;
FormRun formRun;

super();

//info(int2str(LanguageIdEnum.selection()));
if(LanguageIdEnum.selection())
languageId = #EN_ZA;
else
languageId = #EN_US;
if(!(LanguageTable::exist(languageId)))
{
warning(strFmt(„Language %1 is missing!”,languageId));
languageId = LanguageTable::defaultLanguage();
}

info = new xInfo();
infolog.language(languageId);
xNavPane = new xNavPane();
info.mayReloadMenu(true);
xNavPane.loadStartupButtons(); //refresh la meniu..
info.redrawAllWindows();
if(element.args().caller())
{
formRun = element.args().caller();
formRun.close();
}
}

Fără categorie

Delete


public
static
void main(Args _args)

{

Common common;

 


if(_args)

{


if(_args.multiSelectionContext() != null && _args.multiSelectionContext().getFirst() != null)

{


for (common = _args.multiSelectionContext().getFirst(); common; common = _args.multiSelectionContext().getNext())

{


if (common.validateDelete())

{


ttsbegin;

common.selectForUpdate(true);

common.delete();


ttscommit;

}

}

}


else

{


if (_args.record())

{


if(_args.record().validateDelete())

{


ttsbegin;

_args.record().selectForUpdate(true);

_args.record().delete();


ttscommit;

}

}

}

}

}

Fără categorie

AifChangeTracking


 

Query query;

QueryRun queryRun;

AifChangeTracking changeTracking;

AifChangeTrackingTable changeTrackingTable;

FromDateTime localDateTime;

FromDateTime fromDateTime;

InventTable invtable;

 

FromTime startTime = timeNow();

localDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::utcNow(), DateTimeUtil::getUserPreferredTimeZone());

fromDateTime = datetimeUtil::addHours(localDateTime, –abs(real2int(24)));

query = new Query(queryStr(InventItemExportXML_ATX));

// Create query run object

queryRun = new QueryRun(query);

// Get change tracking object

changeTracking = AifChangeTracking::construct(query);

// Get change tracking table

changeTrackingTable = changeTracking.getChanges(fromDateTime);

WHILE
select ChangedTableId, KeyField_RecId from changeTrackingTable group
by ChangedTableId, KeyField_RecId

{

invtable = InventTable::findRecId(changeTrackingTable.KeyField_RecId);

info(strFmt(‘%1’,invtable.ItemId));

}

info(strFmt(„Total time consumed with this operation is %1”, timeConsumed(startTime, timeNow())));

}

 

Fără categorie

AX7 – Debugging code


Codul X++ in AX7 se face in Visual Studio.

Pasi:

  • Deschide codul X++ pentru debugging in Visual Studio.
  • Cu F9 seteaza breakpoint(s).
  • Seteaza startup object.(poate fi orice forma, orice clasa cu metoda main sau orice menu item). Se poate configura in proprietatile proiectului sau click dreapta pe element in Solution Explorer si selecteaza optiunea Set as Startup Object:

  • Din meniul Debug selecteaza Start Debugging
  • Ruleaza codul pentru a prinde breakpoint-ul.

In meniul Debug exista optiunea Autos si in View optiunea Infolog pentru a vedea mai multe detail.

 

Daca se inchide Dynamics AX7 , Visual Studio va iesi din modul debugging.