Günü Sözü
"İyilik yapabildiğim zaman mutlu olurum; ama en büyük mutluluk yapılan bir haksızlığı düzeltmektir." Tolstoy
6 Aralık 2016 Salı
Ax 2012, aot raporu ve fetch metodu / MorphX rapor toolu ile yapılan raporlarda filtreleme ve fetch metodu
public boolean fetch()
{
boolean ret = false; // geri dönüş değerimizi setliyoruz default false veriyoruz.
BankAccountTable_TR bankAccountTable;
QueryRun qrun;
;
qrun = new QueryRun(element);
// eğer qrun değer döndürmez ise false döndürüyoruz.
if (! qrun.prompt())
{
return ret;
}
// query de döngü ile istediğimiz kaytların rapora gönderilmesini sağlayacağız
while (qrun.next())
{
// query deki kaydımızı referans tablomuza setliyoruz.
bankAccountTable = qrun.get(TableNum(BankAccountTable_TR));
//istemediklerimizi filtreliyoruz
if (bankAccountTable.AccountID != "OBANK")
{
// şartları sağlayan kayıtlarımızı raporumuza ekliyoruz yada gönderiyoruz
element.send(bankAccountTable);
}
}
ret = true; // artık geri dönüş değerini true yapabiliriz
return ret;
}
24 Ekim 2016 Pazartesi
Ax 2012 Human Resources / İnsan Kynakları / BorAx modülü personel bilgileri import
ax 2012 de insan kaynakları yada borax ta personel bilgilerini (kimlik bilgileri, banka bilgileri vs..) güncellemek yada sıfırdan (excel, csv..) import etme ihtiyacını duyabiliriz. umarım bu paylaşım faydalı olur.
önce Erd diyagramı paylaşayım.
https://www.microsoft.com/dynamics/ax/erd/ax2012r2/Erd-One-HumanRes-HR1-HcmBenefits.htm
bu job değiştirilerek insert yada parçalı update yapılabilir, aynı zamanda işlem yapılan kayıtları txt dosyasınada yazar.
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
dialogfield dfile;
HcmWorker _hcmWorker;
HcmPersonnelNumberId _hcmPersonnelNumberId;
DirPerson _dirPerson;
DirPersonName _dirPersonName;
DirPartyTable _dirPartyTable;
container line;
//
;
file = new TextIO(#filename, 'W+');
if (!file || file.status() != IO_Status::Ok)
{
throw error("File cannot be opened.");
}
//txt
Dialog = new dialog("Dosya seçin");
dfile = dialog.addField(extendedTypeStr(FileNameOpen),"Dosya");
filename = dfile.value();
if( filename == "" )
throw error("Dosya adı belirtilmemiş");
workbooks.open(filename);
}
throw error("File cannot be opened.");
}
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
row++;
ttsbegin;
do
{
row++;
_hcmPersonnelNumberId = cells.item(row, 1).value().bStr();
_boraxEmplTable.clear();
_boraxEmplTable.PersonnelNumber = cells.item(row, 2).value().bStr();
_boraxEmplTable.OldEmplId = cells.item(row, 2).value().bStr();
_boraxEmplTable.EmplId = cells.item(row, 3).value().bStr();
_boraxEmplTable.EmplName = cells.item(row, 4).value().bStr();
_boraxEmplTable.StartDate = cells.item(row, 5).value().date();
_boraxEmplTable.EndDate= cells.item(row, 6).value().date();
_boraxEmplTable.TCIDNumber = cells.item(row, 7).value().bStr();
_boraxEmplTable.update();
_hcmWorker.PersonnelNumber = cells.item(row, 2).value().bStr();
_hcmWorker.update();
_dirPersonName.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
_dirPersonName.FirstName = cells.item(row, 2).value().bStr();
_dirPersonName.MiddleName = cells.item(row, 3).value().bStr();
_dirPersonName.LastName= cells.item(row, 4).value().bStr();
// txt dosyaya yaz başla
file.outFieldDelimiter(';');// for semicolon seperator
line = [_hcmPersonnelNumberId,cells.item(row, 4).value().bStr(),cells.item(row, 5).value().date(), cells.item(row, 6).value().date(),
cells.item(row, 7).value().bStr()];
file.writeExp(line);
//txt bitir
}
type = cells.item(row+1, 1).value().variantType();
}
info("işlem başarıyla tamamlandı. hadi hayırlı olsun.");
}
info(strFmt(" Personel Hesabı : %1 ",cells.item(row, 1).value().bStr()));
info("işlem sırsaında bir hata oluştu :(");
}
application.quit();
}
17 Ekim 2016 Pazartesi
20 Eylül 2016 Salı
Ax 2012 ssrs -rapor hatası: Error while setting server report parameters. Error message: The DefaultValue expression for the report parameter ‘AX_CompanyName’ contains an error: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (rsRuntimeErrorInExpression)
Ax 2012 de ssrs raporu çalıştırdığımızda bu hata mesajı ile karşılayor iseniz çözümü için aşağıdaki makaleden faydalanabilirsiniz.
https://technet.microsoft.com/en-us/library/hh389774.aspx
export edilen konfigürasyon dosyasını sql sunucusundaki -sql sever versiyonuna göre bu klasör yolu farklıdır- bin klasörünün altına kopyaladığınızda bu problem düzelecektir. Örn.
\Program Files\Microsoft SQL Server\MSRS12.[SSRSInstanceName]\Reporting Services\ReportServer\bin.
19 Eylül 2016 Pazartesi
AX 2012 - sql veritabanının suspect mode düşmesi ve onarımı
https://msdn.microsoft.com/en-us/library/ms176064.aspx
EXEC sp_resetstatus [databaseadi];
ALTER DATABASE [databaseadi] SET EMERGENCY
DBCC checkdb([databaseadi])
ALTER DATABASE [databaseadi] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ([databaseadi], REPAIR_ALLOW_DATA_LOSS)
-veri kaybı yaşanabilir
ALTER DATABASE [databaseadi] SET MULTI_USER
Veritabanı Günlük dosyasını SQL aracılığıyla küçültme / Shrink a Database Log file through SQL
Dynamics AX 2012.USE AXDev;
GO
— log veritabanını SIMPLE moda alalım
ALTER DATABASE AXDev
SET RECOVERY SIMPLE;
GO
— log database 1 mb ta küçültelim
DBCC SHRINKFILE (AXDev, 1);
GO
— şimdi FULL moda alalım tekrar
ALTER DATABASE AXDev
SET RECOVERY FULL;
GO
10 Mart 2016 Perşembe
General Ledger - Trial Balance. From date is in fiscal year xxxx. to date is in fiscal year xxxx. dates must be in same fiscal year.
Ax 2012 R3 Cu 10 cu 11
General Ledger - Trial Balance. From date is in fiscal year xxxx. to date is in fiscal year xxxx. dates must be in same fiscal year.
Getting this error while running the Trial balance.
veya Genel muhasebe - Geçici mizan. parametrelerden iki tarih arası filtre verirken
Geçici Mizanda iki tarih aralığında 01.01.xxxx - 31.12.xxxx parametrelerden güncelleştirme yapılmak istendiğinde " Başlangıç tarihi xxxx mali yılında. Bitiş tarihi ise xxxx mali yılında. Tarihler aynı mali yıl içinde olmalıdır. " hatası veriyor ise
aşağıdaki adımlar ile bu sorun çözülür.
1. Access the AOT (CTRL +D).
2. Navigation: Tools > Caches > "Refresh Dictionary" and "Refresh Data"
3. Delete .auc files. ( Location -> C:\Users\xxx\AppData\Local\xxx.auc)
4.
I had the same issue was resolved by clearing the cache on the effected AOS via a job.
You can run the same and see if it solves your issue.
static void ClearCache(Args _args)
{
LedgerCache::clearAllScopes();
pause;
}
2 Mart 2016 Çarşamba
bir katmandan başka bir katmana projeleri taşıma, kimlik id leri korunarak taşıma
Move objects from one layer to another in AX 2012 by retaining object ids
23 Şubat 2016 Salı
control class ile ms dynamics ax 2012 de ssrs rapor geliştirme örneği - using controller class in developing SSRS Reports in ms dynamics ax 2012
- Modifying a report query based on the input data
- Modifying report contract data based on the input data
- Control a report parameters dialog
- Open different reports/designs from the same menu item based on the input data
- Reports that are opened from a form
Prerequisites
- Microsoft Dynamics AX 2012
- Reporting services extensions must be installed in Dynamics AX
Sample Controller Class
- Create a new class. Open AOT → Classes
- Right Click on Classes and select New Class. Name it as SSRSDemoController.
- Open the Class declaration by right clicking on it and selecting View code.
- Now write the following code:
- Create a new method and write the following code:
1
2
3
4
5
|
class SSRSDemoController extends SrsReportRunController
{
}
|
16 Şubat 2016 Salı
Default boyutlu hareketlerin excele aktarımı
public static void main(Args _args)
{
AssetTrans assetTrans;
SysExcelApplication application;
SysExcelWorkBooks workbooks;
SysExcelWorkBook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;
DimensionAttributeValueSetItemView dimAttrSet;
DimensionAttribute dimAttr;
str dimAttrStr;
Map dims;
int dimNum;
;
application = sysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range(‘A:A’).numberFormat(‘@’);
dims = new Map(Types::String, Types::Integer);
//generate header row++;
cell = cells.item(row, 1);
cell.value(“Voucher“);
cell = cells.item(row, 2);
cell.value(“Transaction date“);
cell = cells.item(row, 3);
cell.value(“Fixed asset number“);
cell = cells.item(row, 4);
cell.value(“Transaction type“);
cell = cells.item(row, 5);
cell.value(“Amount“);
cell = cells.item(row, 6);
cell.value(“Fixed asset group“);
//generate lines while select assetTrans
//The following loop will provide the data to be populated in each column {
row++;
//add fixed asset trans data cell = cells.item(row,1);
cell.value(assetTrans.Voucher);
cell = cells.item(row,2);
cell.value(assetTrans.TransDate);
cell = cells.item(row,3);
cell.value(assetTrans.AssetId);
cell = cells.item(row,4);
cell.value(enum2str(assetTrans.TransType));
cell = cells.item(row,5);
cell.value(assetTrans.AmountCur);
cell = cells.item(row,6);
cell.value(assetTrans.AssetGroup);
// add dimensions while select dimAttrSet
where dimAttrSet.DimensionAttributeValueSet == assetTrans.DefaultDimension
join Name from dimAttr
where dimattr.RecId == dimAttrSet.DimensionAttribute
{
if (!dims.exists(dimAttr.Name)) // if dim column does not exists {
//add dimension column dims.insert(dimAttr.Name, dimNum + 7);
dimNum++;
cell = cells.item(1, dims.lookup(dimAttr.Name));
cell.value(dimAttr.Name);
}
//add dimension value cell = cells.item(row, dims.lookup(dimAttr.Name));
cell.value(dimAttrSet.DisplayValue);
}
}
application.visible(true); // opens the excel worksheet}
27 Ocak 2016 Çarşamba
ax 2012, X++ kodları ile özelleştirilmiş lookup. ax 2012 X++ code to create a customized lookup on form
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup; // systemclass to create //customlookup
Query query;
QueryBuildDataSource qbd;
;
sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable),_formcontrol);
// Construct query on the table,
// whose records you want to show as lookup.
query = new Query();
qbd = query.addDataSource(tablenum(InventTable));
qbd.addRange(fieldnum(InventTable,ItemType)).value(SysQuery::value(enum2str
(ItemType::Item)));
// add the fields to the lookup list
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemId));
sysTableLookup.addLookupfield(fieldnum(InventTable,ItemName));
// pass the query as parameter
// system will show the records in the lookup
// as per your query
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Building Lookups - Using a form for lookup building
In this recipe, we will demonstrate how to create a lookup using an AOT form. As an example, we will modify the standard customer account lookup to display only active customers.
How to do it...
-
-
2. Change the form's following design properties:
Property Value
Frame Border
WindowType Popup
-
-
4. Add a new StringEdit control to the grid:
Property Value
Name AccountNum
DataSource CustTable
DataField AccountNum
AutoDeclaration Yes
-
5. Add another StringEdit control to the grid, right after AccountNum:
Property Value
Name Name
DataSource CustTable
DataField Name
-
6. Add one more StringEdit control to the grid, right after Name:
Property Value
Name Phone
DataSource CustTable
DataField Phone
-
-
-
9. Override the form's run() with the following code:
public void run()
{
FormStringControl callingControl;
boolean filterLookup;
;
callingControl = SysTableLookup::getCallerStringControl(
element.args());
filterLookup = SysTableLookup::filterLookupPreRun(
callingControl,
AccountNum,
CustTable_ds);
super();
SysTableLookup::filterLookupPostRun(
filterLookup,
callingControl.text(),
AccountNum,
CustTable_ds);
}
-
10. Finally, override init() of the CustTable data source with the following code:
public void init()
{
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
query = new Query();
qbds = query.addDataSource(tablenum(CustTable));
qbr = qbds.addRange(fieldnum(CustTable, Blocked));
qbr.value(queryvalue(CustVendorBlocked::No));
this.query(query);
}
-
- 2. Change the form's following design properties:
Property Value Frame Border WindowType Popup
- 4. Add a new StringEdit control to the grid:
Property Value Name AccountNum DataSource CustTable DataField AccountNum AutoDeclaration Yes
- 5. Add another StringEdit control to the grid, right after AccountNum:
Property Value Name Name DataSource CustTable DataField Name
- 6. Add one more StringEdit control to the grid, right after Name:
Property Value Name Phone DataSource CustTable DataField Phone
- 9. Override the form's run() with the following code:
public void run() { FormStringControl callingControl; boolean filterLookup; ; callingControl = SysTableLookup::getCallerStringControl( element.args()); filterLookup = SysTableLookup::filterLookupPreRun( callingControl, AccountNum, CustTable_ds); super(); SysTableLookup::filterLookupPostRun( filterLookup, callingControl.text(), AccountNum, CustTable_ds); } - 10. Finally, override init() of the CustTable data source with the following code:
public void init() { Query query; QueryBuildDataSource qbds; QueryBuildRange qbr; ; query = new Query(); qbds = query.addDataSource(tablenum(CustTable)); qbr = qbds.addRange(fieldnum(CustTable, Blocked)); qbr.value(queryvalue(CustVendorBlocked::No)); this.query(query); }
-
12. Locate the extended data type CustAccount in AOT, and change its property:
Property Value
FormHelp CustLookup
-
13. To test the results, open Accounts receivable | Sales Order Details and start creating a new sales order. Notice that now Customer account lookup is different, and it includes only active customers:
- 12. Locate the extended data type CustAccount in AOT, and change its property:
Property Value FormHelp CustLookup
- 13. To test the results, open Accounts receivable | Sales Order Details and start creating a new sales order. Notice that now Customer account lookup is different, and it includes only active customers:




