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

24 Kasım 2017 Cuma

çağıran formun tablo kayıt form datasource bilgilerine erişim, yenileme

Aşağıdaki kodlar ile çağıran nesnenin formun işlevlerini yöntemlerini, kayıt tabo datasource vs bilgilerini çağırmak kullanmak için kullanılır

void workWithCallingRecord()
{
    common          common;
    object          object;
    formDataSource  formDataSource;
    formRun         formRun;
    inventDim       inventDim;
    salesTable      salesTable;
    int             i;
    ;
    // Call method from calling record
    if( element.args() &&
        element.args().record() )
    {
        common = element.args().record();
        if(common.isFormDataSource())
        {
            info(tableId2Name(common.TableId));
            if(formDataSourceHasMethod(common.dataSource(), identifierStr("someMethod")))
            {
                object = common.dataSource();
                object.someMethod();
            }
        }
    }
 

    // Call method from calling form
    if(element.args() && element.args().caller() && element.args().caller().handle() == className2Id('formRun'))
    {
        formRun = element.args().caller();
        if(sysFormRun::hasMethod(formRun, identifierStr("someFormMethod")))
        {
            object = formRun;
            object.someFormMethod();
        }
    }

    // Get value from calling record
    if( element.args() &&
        element.args().record() )
    {
        common = element.args().record();
        if(common.TableId == tableNum(salesTable))
        {
            info(common.(fieldNum(salesTable, salesId)));
        }
    }

    // Get value from calling datasource (form with multiple datasources)
    if(element.args() && element.args().caller() && element.args().caller().handle() == className2Id('formRun'))
    {
        formRun = element.args().caller();
        for (i = 0; i <= formRun.dataSourceCount(); i++)
        {
            formDataSource = formRun.datasource(i);
            if (formDataSource && formDataSource.table() == tablenum(inventDim))    // Search for specific table
            {
                inventDim = formDataSource.cursor();
                break;
            }
        }
        if(inventDim)
        {
            info(inventDim.InventLocationId);
        }
    }

    // Change data in calling datasource
    if(element.args() && element.args().caller() && element.args().caller().handle() == className2Id('formRun'))
    {
        formRun = element.args().caller();
        for (i = 0; i <= formRun.dataSourceCount(); i++)
        {
            formDataSource = formRun.datasource(i);
            if (formDataSource && formDataSource.table() == tablenum(salesTable))    // Search for specific table
            {
                salesTable = formDataSource.cursor();
                break;
            }
        }
        if(salesTable)
        {
            // Update data
            salesTable.PurchOrderFormNum = "Some value";
            salesTable.update();
        }
    }

    // Refresh calling datasource
    if( element.args() &&
        element.args().record() )
    {
        common = element.args().record();
        if(common.isFormDataSource())
        {
            formDataSource = common.dataSource();
            formDataSource.research(true);
        }
    }
}
---

FormRun         formRun;
FormObjectSet   formObjSet;

int             i;
InventTable     inventTable;

// refresh and reread inventTable datasource if exists in form
formRun = this.dataSource().formRun();
for (i=1; i<= formRun.dataSourceCount(); i++)
{
if (formRun.dataSource(i).cursor() is InventTable)
{
formObjSet = formRun.dataSource(i);
inventTable = formObjSet.cursor() as InventTable;
break;
}
}

****

PurchTable purchTable;
PurchTable argPurchTable;

select firstOnly purchTable;
args.record(purchTable);

if (args.record() && args.dataset() == tableNum(PurchTable))
{
    argPurchTable = args.record();
    //do something
}
yenileme

1.yol:
    #Task
    FormRun formRun;
    
    // Get an instance of the calling form.
    formRun = element.args().caller();
    
    // If the caller is a form, refresh that form.
    if(formRun)
    {
        formRun.task(#taskF5);
    }

2.yol:

    FormRun         callerForm;
    ;
    // Get an instance of the calling form
    callerForm          = element.args().caller();
    callerForm.dataSource().refresh();
    callerForm.dataSource().reread();
    callerForm.dataSource().research();

3.yol:

   FormDataSource   callerDataSource;
   ;
   callerDataSource = element.args().record().dataSource();
   callerDataSource.research(true);
4.yol:

FormDataSource          fds;

      _CallerTable = element.args().record();

      if (_CallerTable .isFormDataSource())

      {

          fds = _CallerTable.dataSource();

          if (fds)

          {

              fds.executeQuery();

          }

      }

8 Ağustos 2017 Salı

X++ code to write data to XML File in Job

X++ kodları ile satınalma siparişlarinin xml e dönüştürülmesi
X++ code to write data to XML File in Job
static void CreateXmlPurch(Args _args)
{
XmlDocument xmlDoc; //to create blank XMLDocument
XmlElement xmlRoot; // XML root node
XmlElement xmlField;
XmlElement xmlRecord;
XMLWriter xmlWriter;
InventTable inventTable;
DictTable dTable = new DictTable(tablenum(PurchTable));
DictField dField;
int i, fieldId;
str value;
PurchTable purch;
//#InventTags
;

xmlDoc = XmlDocument::newBlank();
xmlRoot = xmlDoc.createElement("Purch");//#ItemRootNode);

// Loop through all the records in the inventTable
while select purch
where purch.PurchStatus == PurchStatus::Backorder
{
// Create a XmlElement (record) to hold the
// contents of the current record.
xmlRecord = xmlDoc.createElement("Records");//#ItemRecords);
// Loop through all the fields in the record
for (i=1; i<=dTable.fieldCnt(); i++)
{
fieldId = dTable.fieldCnt2Id(i);
// Find the DictField object that matches
// the fieldId
dField = dTable.fieldObject(fieldId);

// Skip system fields
if (dField.isSystem())
continue;
// Create a new XmlElement (field) and
// have the name equal to the name of the
// dictField
xmlField = xmlDoc.createElement(dField.name());
// Convert values to string. I have just added
// a couple of conversion as an example.
// Use tableName.(fieldId) instead of fieldname
// to get the content of the field.
switch (dField.baseType())
{
case Types::Int64 :
value = int642str(purch.(fieldId));
break;
case Types::Integer :
value = int2str(purch.(fieldId));
break;
default :
value = purch.(fieldId);
break;
}
// Set the innerText of the XmlElement (field)
// to the value from the table
xmlField.innerText(value);
// Append the field as a child node to the record
xmlRecord.appendChild(xmlField);
}
// Add the record as a child node to the root
xmlRoot.appendChild(xmlRecord);
}
// Add the root to the XmlDocument
xmlDoc.appendChild(xmlRoot);
// Create a new object of the XmlWriter class
// in order to be able to write the xml to a file
xmlWriter = XMLWriter::newFile(@"c:\PurchaseOrders.xml");
// Write the content of the XmlDocument to the
// file as specified by the XmlWriter
xmlDoc.writeTo(xmlWriter);

//Open the file in Internet Explorer
WINAPI::shellExecute("c:\PurchaseOrders.xml");
}

27 Haziran 2017 Salı

AX'te form ve tablodaki sıralama yada yöntem dizisi yada sırası

AX 2012 R2-R3 vs  form ve tablodaki sıralama yada metotların sırası

Form:
Sequence of Methods calls while opening the Form
Form — init ()
Form — Datasource — init ()
Form — run ()
Form — Datasource — execute Query ()
Form — Datasource — active ()
Sequence of Methods calls while closing the Form
Form — canClose ()
Form — close ()
Sequence of Methods calls while creating the record in the Form
Form — Datasource — create ()
Form — Datasource — initValue ()
Table — initValue ()
Form — Datasource — active ()
Sequence of Method calls while saving the record in the Form
Form — Datasource — ValidateWrite ()
Table — ValidateWrite ()
Form — Datasource — write ()
Table — insert ()
Sequence of Method calls while deleting the record in the Form
Form — Datasource — validatedelete ()
Table — validatedelete ()
Table — delete ()
Form — Datasource — active ()
Sequence of Methods calls while modifying the fields in the Form
Table — validateField ()
Table — modifiedField ()

Table:
When you press CTR+N
initValue()->

When you change data in a field
validateField() -> validateFieldValue() -> ModifiedField() -> ModifiedFieldValue()

When you close the table after entering some data
validateWrite() – > Insert() -> aosValidateInsert()

When you Save the Record for the first time
validateWrite() ->Insert() – > aosValidateInsert()

When you modify the record and saving
validateWrite() -> update() – > aosValidateUpdate()

When you delete the record
validateDelete() -> delete() -> aosValidateDelete()

5 Mayıs 2017 Cuma

Kendi filter dialog yada contex menümüz...

Display method in dynamics AX
Display metodları ile kendi menümüzü yapabiliriz. Tablodaki bir alan üzerinden filtreleme yapabiliriz.



1.      Bir display metod ekleyelim.  (disCustName) alanına ekleyelim onun üzerinden yapalım. Form adı "IND_BusRelation” formu. formdaki datasource ise  “smmBusRelTable”.

2. disCustName bu alanın özelliklerinden property sini değiştirelim.   “AutoDeclaration” Yes olacak. (Change “AutoDeclaration” property from No to Yes of the “disCustName” data field.)

3.    Bir tane metod yazalım. Var olan metodlardan override edelim. (   Override “context()” method of the “disCustName” data field and add following code.)

  
public void context()
{
    int             selectedMenu;
    formrun         fr;
    Args            ag;
    Name            strtext;
    querybuilddataSource qb1;
    queryrun    qr;
    query       q;
    PopupMenu menu = new PopupMenu(element.hWnd());
    int a = menu.insertItem('Filter By Field');
    int b = menu.insertItem('Filter By Selection');
    int c = menu.insertItem('Remove Filter');
    ;

    selectedMenu = menu.draw();
    switch (selectedMenu)
    {
    case -1: //Filter by field
            break;
    case a:
            ag = new args('SysformSearch');
            fr = new formrun(ag);
            fr.run();
            fr.wait();
//Reading User entered value for filter process
            strtext = fr.design().controlName('FindEdit').valueStr(); 
            if(strtext)
            {
//Creating a query for filter
                q   = smmBusRelTable_ds.query();
                qb1 = q.dataSourceTable(tablenum(smmBusRelTable));
                qb1 = qb1.addDataSource(TableNum(CustTable));
                qb1.addLink(FieldNum(smmBusRelTable,CustAccount),FieldNum(CustTable,AccountNum));
                qb1.addRange(FieldNum(CustTable,Name)).value(strtext);
                smmBusRelTable_ds.query(Q);
                smmBusRelTable_ds.executeQuery();
            }
            break;

    case b:   // Filter By Selection
            q   = smmBusRelTable_ds.query();
            qb1 = q.dataSourceTable(tablenum(smmBusRelTable));
            qb1 = qb1.addDataSource(TableNum(CustTable));
            qb1.addLink(FieldNum(smmBusRelTable,CustAccount),FieldNum(CustTable,AccountNum));
            qb1.addRange(FieldNum(CustTable,Name)).value(disCustName.valueStr());
            smmBusRelTable_ds.query(Q);
            smmBusRelTable_ds.executeQuery();
            break;
    case c :   // Remove Filter
            q   = new Query();
            qb1 = q.addDataSource(tablenum(smmBusRelTable));
            qb1.clearLinks();
            qb1.clearRanges();
            smmBusRelTable_ds.query(Q);
            smmBusRelTable_ds.removeFilter();
            break;

    Default:
            break;
    }

}

4.      Formu çalıştıralım. Run the form and do right Click on Customer Name field.)

24 Şubat 2017 Cuma

AX 2012 - SSRS - Make sure that SQL Server Reporting Services is configured correctly. Verify the Web Service URL and Report Manager URL configuration in the SQL Reporting Services Configuration Manager.

Ax 2012 R3 ssrs sunucu ayarları yapılırken aşağıdaki hata ve çözümü işimizi görecektir.

Make sure that SQL Server Reporting Services is configured correctly. Verify the Web Service URL and Report Manager URL configuration in the SQL Reporting Services Configuration Manager.



Ax 2012 uygulamsını sağ tuş- Run Administrator




Bir diğer çözümü ise registerden aşağıdaki ilgili alanın değerini 1 den 0 a çekmek



2 Şubat 2017 Perşembe

SQL serverda “collation” yada “character set” değiştirme

SQL serverda “collation”  yada “character set” değiştirelim. nedir bu karakter set ne işe yarar.

misal where koşulundaki eşitliklerde, order (sıralama) işleminde, büyük küçük harf ayrımında karakterlerin hangi mantıkta kullanılacağını vs gibi  

Karakter set sorunlarından biri where koşulu ile verilen bir koşula uyan kayıt(lar) olmasına rağmen kayıtların gelmemesi örneği gösterilebilir.

önce veritabanını single moda almadan deneyelim.

USE MASTER;

GO

ALTER DATABASE ErmAxRapor

COLLATE SQL_Latin1_General_CP1_CI_AS ;

GO

 

--BAKALIM OLMUSMU

USE MASTER;

GO

SELECT *

FROM SYS.DATABASES

WHERE NAME = N'[ErmAxRapor]';

GO


USE MASTER;

GO

 

-- SET TO SİNGLE-USER MODE

ALTER DATABASE EARapor

SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

  


ALTER DATABASE EARapor

COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS;  

GO  

 

-- SET TO MULTİ-USER MODE

ALTER DATABASE EARapor

SET MULTI_USER WITH ROLLBACK IMMEDIATE;

GO  

 

--BAKALIM OLMUSMU.  

SELECT NAME, COLLATION_NAME  

FROM SYS.DATABASES  

WHERE NAME = N'EARapor';  

GO

25 Ocak 2017 Çarşamba

Pratik ax 2012 çözümleri / aot dan kod ile çözümler

 

Bir şekilde açılan ama kapatılamayan ttsbegin- ttscommit hatalarının temizlenmesi


static void ResetTTS(Args _args) 
{

while (appl.ttsLevel() > 0)
 
 
{

info( strfmt("kapatılan/temizlenen %1 açık ttsbegin/commit blogu" ,appl.ttsLevel()));

ttsAbort;
 
 

}

}

 

aos refresh/ auc dosyalarının kod ile temizlenmesi

[Menu items > Action]

SysFlushAOD
SysFlushData
SysFlushDictionary

 veya
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::doFlush();
SysFlushAOD::doFlush();
xSession::updateAOC();


Aos ve ssrs servislerini start etme / durdurma


net stop “<"service name">”
net start ReportServer
net start  aosname


Komut satırından aos  derleme/ compile

cmd ile komut satırına girdikten sonra; (cd ile ilgili alt klasörün içine girelim)

C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin>
axbuild.exe xppcompileall /s=01  /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"






3 Ocak 2017 Salı

Report Server sorunlarından


Reporting servisi başlatılamaz yada hata verdiğinde hata mesajı aşağıdaki gibi ise

Reporting Services failed to start with the error message 

“Error 1053 is received: The service did not respond to the start or control request in a timely fashion”.

Solution/Çözüm

Zaman aşımı sorunu

The problem is usually caused by an incorrect timeout setting. To work around the issue, try the following steps:

1.      Click Start, click Run, type regedit, and then click OK.

2.      Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

3.      In the right pane, locate the ServicesPipeTimeout entry.Note If the ServicesPipeTimeout entry does not exist, you must create it. To do this, follow these steps:

a.      On the Edit menu, point to New, and then click DWORD Value.

b.      Type ServicesPipeTimeout, and then press ENTER.

4.      Right-click ServicesPipeTimeout, and then click Modify.

5.      Click Decimal, type 60000, and then click OK. This value represents the time in milliseconds before a service times out.

6.   Restart the computer.






https://social.msdn.microsoft.com/Forums/sqlserver/en-US/803110fe-0b1f-4bed-a778-e1f6a0797a98/forum-faq-how-do-i-resolve-the-reporting-server-error-1053-the-service-did-not-respond-to-the?forum=sqlreportingservices