Günü Sözü

"Hiçbir şey bilmeyen cahildir, ama bilip de susan ahlaksızdır. " Bertolt Brecht.
"İyilik yapabildiğim zaman mutlu olurum; ama en büyük mutluluk yapılan bir haksızlığı düzeltmektir." Tolstoy

4 Aralık 2015 Cuma

sql database suspend moddan kurtarılması -recovery-

EXEC sp_resetstatus 'DBname';

ALTER DATABASE DBname SET EMERGENCY

DBCC checkdb('DBname')

ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE

DBCC CheckDB ('DBname', REPAIR_ALLOW_DATA_LOSS)

ALTER DATABASE DBname SET MULTI_USER

detaylı bilgi için

1 Ekim 2015 Perşembe

ax 2012 send report with x++ code

 

void clicked()
{
SrsReportRun srsReportRun;
srsReportRun = new SrsReportRun ("reporadi.dizaynadi");
srsReportRun.init();
srsReportRun.reportCaption("başlık");
srsReportRun.reportParameter(" örnek:SalesInvoiceDS_CustAccount").value(CustTable.AccountNum);
srsReportRun.executeReport();
}

1 Eylül 2015 Salı

AX 2012 How to: Add a Lookup Form to a Control - ax 2012 de form kontrollerine lookup eklemek.

In the AOT    -> expand Forms -> form-> Designs -> right-click Design -click New Control, and then click StringEdit. A StringEdit control is added to the form.
 AOT üzerinde    -> Formlar ->Form-> Designs -> sağ-tuş tık Design - New Control tıklanır,  ve StringEdit seçilir. Bu StringEdit  kontrolü forma eklenir.

     Right-click the control, and then click Properties. Review the following properties.
bu kontrol özelliklerine Sağ tuş tıklanarak uşaşarak aşağıdaki alanları istediğimiz şekilde düzenleriz.




DataSource : eğer bir datasource bağlantısı verecekek seçelim
DataField : eğer bir datafield e bağlayacaksak seçelim.
Name : Bu kontrole  isim verelim.
Label: ilgili kontrolün etiketini yazalım
Ardından aşağıdaki şekilde, override metodlardan lookup seçip design a ekleyelim.
 
 
 The following code example adds the classes you use to construct the query for the lookup form.  
Aşağıdaki kodu şekilde lookup ın içini dolduralım. 
 
public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange; 
// SysTableLookup class ından için yeni bir lookup class türetelim
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);
//alanlar
    sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
    sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));
//datasource ümüze ekleyelim
    queryBuildDataSource = query.addDataSource(tableNum(CustTable));
// range vermek isetersek açalım bu kısmı
  //  queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustTable, CustGroup));
   // queryBuildRange.value('40');

    sysTableLookup.parmQuery(query);
//lookup ı açalım
    sysTableLookup.performFormLookup();

    //super();
}

12 Ağustos 2015 Çarşamba

MS SQL PIVOT ve UNPIVOT kullanımı, veritabanı uyumluluk sorunları-çözümleri

PIVOT ve UNPIVOT SQL Server 2005 sürümüne veya daha üzeri bir sürüme yükseltilen veritabanlarında kullanılır. Veritabanının uyumluluk düzeyi 90 veya üzeri bir değere ayarlanmalıdır.
 
Msg 325, Level 15, State 1, Line 5

Incorrect syntax near 'PIVOT'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the stored procedure sp_dbcmptlevel.
 
Yukardaki hatayı alıyorsanız ve
Microsoft SQL 2005 versiyonunda veritabanı uyumluluğu 90 değerinin altında ise;
Database değeri single moda alınır 
  ALTER DATABASE AdventureWorks   
  SET SINGLE_USER 
  GO

Sonra 
  EXEC sp_dbcmptlevel AdventureWorks, 90;
  GO 

En son ise tekrar multi user moda alınır.
 
  ALTER DATABASE AdventureWorks 
  SET MULTI_USER 
  GO
 
SQL Server versiyonu 2005 ve üzeri ise 90 değerine ayarlamak için bu sefer
    ALTER DATABASE AdventureWorks SET COMPATIBILITY_LEVEL=90
yapılır.
 
Örnek Pivot uygulaması (Ambar toplamları):
USE XXXX
go  
select stokkodu, stokadi, [ÇİNKO],[FASGEL],[FOSFAT],[MALKABUL],[MANGAN],[REDMK] from XXXX ) tablom
PIVOT (
sum(kalan)
 FOR AmbarNo IN ([ÇİNKO],[FASGEL],[FOSFAT],[MALKABUL],[MANGAN],[REDMK])
) PivotToplam
WHERE StokKodu='732740'
ORDER BY stokkodu
 
 
 
 Unpivot  örneği ise ambarlar satırda gösterilebilir.
farklı bir örnek verelim bunun için;
CREATE TABLE pvt (VendorID int, Emp1 int, Emp2 int,
    Emp3 int, Emp4 int, Emp5 int);
GO
INSERT INTO pvt VALUES (1,4,3,5,4,4);
INSERT INTO pvt VALUES (2,4,1,5,5,5);
INSERT INTO pvt VALUES (3,4,3,5,4,4);
INSERT INTO pvt VALUES (4,4,2,5,5,4);
INSERT INTO pvt VALUES (5,5,1,5,5,5);
GO
--Unpivot the table.
SELECT VendorID, Employee, Orders
FROM
   (SELECT VendorID, Emp1, Emp2, Emp3, Emp4, Emp5
   FROM pvt) p
UNPIVOT
   (Orders FOR Employee IN
      (Emp1, Emp2, Emp3, Emp4, Emp5)
)AS unpvt;
GO










 

Role-Based Security with Forms in Microsoft Dynamics AX 2012 - Role bazlı güvenlik ayarları ax 2012

Başlarken,
  1. Microsoft Dynamics AX 2012
  2. (System administration à Common à Users à Users)
Önemli kavramlar:
1. Security roles
2. Process cycles
3. Duties
4. Privileges
5. Entry point
  • Menu items
  • Web menu items
  • Service operations
6. Permissions
  • Read
  • Update
  • Create
  • Correct
  • Delete
  • No Access
 
Rol bazında güvenlik yarlrını, Müşteri gruplarına uygulayalım. (Accounts receivable à Setup à Customers à Customer groups).
 
Adımlar
  1. First, to create a new privilege go to AOT à Security à Privileges
  2.  
  3. Right click on Privileges and select New Privilege
  4.  
  5. Name it CustomerGroupView
    Note: It is a best practice to name a Privilege as MenuItemName + View/Maintain depending upon the Access level
  6.  
  7. Set the Label of the privilege as Customer group view

  8.  
  9. Now expand the newly created privilege and create an entry point by right clicking on Entry Points and selecting New Entry Point
  10.  
  11. Name the entry point as CustGroup and set the AccessLevel to Read
  12.  
  13. Set the ObjectType to MenuItemDisplay and ObjectName to the menu item of the Customer group form, CustGroup
  14.  
  15. Save the privilege
  16.  
  17. Now create a duty and assign the above created privilege to the duty
  18.  
  19. Go to AOT à Security à Duties
  20.  
  21. Right click on Duties and select New Duty to create a new duty

  22.  
  23. Name the duty as CustomerGroupView and set the Label as Customer group view
  24.  
  25. Expand the above created duty and create a new privilege by right clicking on the Privileges node and select New Privilege
  26.  
  27. Select the CustomerGroupView privilege in the Name field and save the duty
    Note: You can also drag and drop the privilege on the Privileges node
  28.  
  29. Next create a new role by going to AOT à Security à Roles
  30.  
  31. Right click on Roles node and select New Role
  32.  
  33. Name the role as SecurityDemo and Label it as Security demo
  34.  
  35. Expand the above created role and right click on Duties node and select New Duty
  36.  
  37. Select the CustomerGroupView duty in the Name field and save the role
  38. Note: You can also drag and drop the duty on the Duties node
     
  39. Now assign the above role to a user Dynamics AX. Go to System administration à Setup à Security à Assign users to roles
  40.  
  41. On the Assign users to roles form, select the above created role in the left tree and click on Manually assign / exclude users
  42.  
  43. In the opened dialog, select the user to which you want to assign the role and press Assign to role
  44.  
  45. A green check mark will appear in case of successful assignment. Close the form
  46.  
  47. Now login with the selected role
  48.  
  49. Only the functions assigned to the user will be visible. In this case only the Customer groups form is visible since the Security Role contains only one duty. Also note that only those Menus will be visible that contains the menu item assigned in the Privilege

11 Haziran 2015 Perşembe

Ax 2012 cil işlemi, ful cill yapma

Prerequisite: Make sure that a full X++ compile was run without errors before

1) Stop all relevant AOS server(s)

2) On your relevant AOS server(s) navigate to the following folder (default) using Windows
Explorer:
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL

3) Make sure you create a safe copy of the XPPIL folder content to another new local folder
on the AOS computer (example: C:\XPPIL_SAVE)

4) Now delete all folders and files inside the folder “C:\Program Files\Microsoft Dynamics
AX\60\Server\MicrosoftDynamicsAX\bin\XppIL” but keep the folder “XPPIL” itself.

5) Start all AOS server(s)

6) Run a full CIL creation from AOT. This will create a fresh rebuild of all files/ folders
inside the XPPIL folder

• çok önemli bazı CIL prensiplerinin üzerinden geçelim:
1. CIL paketinin olusması için bütün Class ve Tablo metodları ile Enum’ların hatasız derlenmesi
gerekmektedir. Form ve Sorgulardaki hatalar CIL’in olusmasını engellemez.

2. CIL paketi tam derlenmeden Servisler (AIF), SSRS raporları ve Batch Islemler ÇALISAMAZ!

3. Incremental CIL adı üzerinde CIL pakete ekleme yapar, silinmis bir metodu silmez. Böyle bir
islem yaptıysanız, ilgili AOS sunucu üzerinde:

C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL\

Yolunda tanımlı bulunan bütün CIL dosyalarını silerek veya Full CIL derlemesi yaparak paketi
yeniden üretmelisiniz.

Başlangıçta servis durdurulduktan sonra Model veritabanındaki SysXppAssembly tablosunun bütün kayıtlarını
silebilirsiniz.

alternatif kaynak
https://ax2012anant.blogspot.com/2014/05/how-to-generate-cilcommon-intermediate.html

27 Ocak 2015 Salı

Ax 2012 de satır renklendirme

ax 2012 de grid de satırları (herhangi bir koşula göre) renklendirme ihtiyacı duyabiliriz.

1.  ilgili formun datasource na gidelim.
2- renklendirme yapacağımız gridin datasource nu bulalım.
3- metodlar üzerinden sağ tuş ile override method lardan displayOption metodunu seçelim ve aşağıdaki kodu yada ihtiyacınız olan düzenlemeyi yapalım. ilgili formu yeniden açalım.

public void displayOption(Common _record, FormRowDisplayOption _options)
{
   HcmWorker           _hcmworker = HcmWorker::find(_record.RecId);
   Integer                     backColor = WinAPI::RGB2int(50,255,50) ;
   if( _hcmworker.DirPerson().EmplIdentNumber!='')
   _options.textColor(backColor);
   
super(_record, _options);

}