Sunday, 11 October 2015

data migration process from one db to other DB

Data Migration Process
                                                Data migration is the process of migrating data from one database to another database (i.e importing data from source db to target db) by mapping the fields of source and destination tables respectively.
Here we followed the process using SQL server integration tool (i.e DB to DB importing process )
à Open Visualstudio select new project Templates > Business Intelligence >Integrated services
àIn integrated services >select the Solution Explorer >Go to SSIS Packages >new Package >rename the package
àOn the left hand side select the dataflow >drag & drop the OLE DB source component and OLE DB destination component.
àNow goto OLE DB Source> double click on it > Select the server name, database name & table name (i.e from this server, database & table, the data is ready to import on destination) then click ok
Note: while clicking ok please check the columns are marked or not
Example: Here we selected servername as INSVR07, DB as TTC_2009, Sales Table, check test connection whether the connection is succeeded or not
àSelect the Source component, map it to the destination component (i.e select source component then one blue down arrow appears on it just simply drag it on the destination component)
àNow Double Click on the destination > Select the server name, database name & table name (i.e to this server, database, table the data is going to import from the source) now click on mapping and Map the both fields and click ok
Example: Here we selected servername as INSVR07, DB as TTC_2012, Sales Table, check test connection whether the connection is succeeded or not
àif any error symbols shows it means mapping doesn’t done correctly or if no any errors occurs mapping was done successfully
àFinally, Select both source and destination components then right click > Select execute Task
  If it shows any error occurs check it in process tab.

àNow the data is imported from source to destination tables

Monday, 21 September 2015

code for making bold letters for a dialogue text in ax 2012

Dialog dialog = new Dialog();
DialogText dt = dialog.addText("Test");
FormBuildStaticTextControl txtCtl = dt.control();
txtCtl.bold(7);

dialog.run();

Saturday, 19 September 2015

Code is working fine in Dev VM but in Test VM it is not working fine

Say we have developed one functionality or some customization in some so called form in dev VM and you have moved the code to test VM and you observe that  the code is not working fine as it is supposed to be.

Please go to test VM and clear the cache and refresh the table, data dictionary,

after that the code should work fine as it is supposed to be.

Tuesday, 15 September 2015

bp error - The relation under the extended data type (EDT) SalesIdBase must be migrated to a table relation. Consider using the EDT relation migration tool.

  some time we get bp error when we set the compiler level to 4 and go the compilation of code

like :

The relation under the extended data type (EDT) SalesIdBase must be migrated to a table relation. Consider using the EDT relation migration tool.


go to development AX then click on tools>>>code upgrade>> edt migration tool select the table in right hand side you will have migrate all   then in top  click on migrate single table and at last you will get message like edt has been migrated for the table.

Wednesday, 9 September 2015

Moving projects across models in ax 2012

 Moving projects across models

When moving a project from one model to another there is a particular process that must be followed:
1)    Create a new dummy project in any model

2)    Move all items from the current project into the dummy project
3)    Move the original project (now empty), into the new model
4)    Move all the items back from the dummy project into the original project
The reason for this set of rules exists due to the fact that if a project with elements in mixed models is moved to a new model, it will update all the child object to the same model.




can we  create a new project  in a new model and  move the  objects  from the  projects to newly created project.

Tuesday, 8 September 2015

look up with the all table fields of a table in ax 2012

Please refer :

 \Classes\WrkCtrBulkEditController\init          

protected void init()
{
    FormRun             callerForm;
    FormDataSource      callerFormDataSource;
    FormDataSource      baseFormDataSource;
    DictTable           dictTable;
    fieldId             currentFieldId;
    WrkCtrBulkEditField wrkCtrBulkEditField;
    int                 dataSourceCount;
    int                 dataSourceIndex;
    int                 fieldMapKey = 0;

    if( formObject && formObject.args() )
    {
        callerForm = formObject.args().caller();
    }

    if( callerForm )
    {
        baseFormDataSource = callerForm.dataSource();

        dataSourceCount = callerForm.dataSourceCount();

        for (dataSourceIndex = 1; dataSourceIndex <= dataSourceCount; ++dataSourceIndex)
        {
            callerFormDataSource = callerForm.dataSource(dataSourceIndex);

            if (!this.isInnerJoined(baseFormDataSource, callerFormDataSource))
            {
                continue; // only process inner-joined datasources
            }

            dictTable = new DictTable( callerFormDataSource.table() );

            if (dictTable && hasTableAccess(dictTable.id()))
            {

                for( currentFieldId = dictTable.fieldNext(0); currentFieldId; currentFieldId = dictTable.fieldNext(currentFieldId) )
                {
                    wrkCtrBulkEditField = WrkCtrBulkEditField::newFromDatasourceField(callerFormDataSource, dictTable.fieldObject(currentFieldId) );

                    //if( wrkCtrBulkEditField.isEditable() )
                    {
                        fieldsMap.insert( fieldMapKey, wrkCtrBulkEditField );
                        fieldMapKey++;
                    }

                }
            }
        }
    }
}

Please debug this class and find out how the look up is getting created                                                52

Sunday, 30 August 2015

classes for changing the amount for the vouchers of sales order invoice

markup class and method :calcTrans

under that

this class is usally called when ever we create a sales order  and check the auto charges linked with the sales order based on the selection on the auto charges form set up.

Sunday, 16 August 2015

look up on table and calling it on form datasource

create a method on table like

public client static void lookupInvoiceDayOKN(FormStringControl _ctrl, PaymDayId _filter)
{
 
    // Intantiantes a SysTableLookup object telling it which control activated the lookup, and
    // what table should be displayed inside the lookup form.
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(PaymDay), _ctrl);

    Query query = new Query(); // This query will be used by the lookup form.
    QueryBuildDataSource qbds;

    ;

    // The "addLookupField" method adds the the fields that will be shown inside the lookup's grid.
    // The second, boolean parameter indicates that this field will be returned from the lookup when a
    // record is selected. In this case, we'll return our DummyPK.
    sysTableLookup.addLookupField(fieldnum(PaymDay, PaymDayId), true);
    //sysTableLookup.addLookupField(fieldnum(PaymDay, Field1));
    //sysTableLookup.addLookupField(fieldnum(PaymDay, Field2));
    //sysTableLookup.addLookupField(fieldnum(PaymDay, Field3));


    // Using our dummy table as a DataSource Table.
    qbds = query.addDataSource(tablenum(PaymDay));

    // This is the key part, what we want to filter to be displayed in the grid.
   // qbds.addRange(fieldnum(PaymDay, PaymDayId )).value(_filter);


    // Passes the query to the sysTableLookup.
    sysTableLookup.parmQuery(query);

    // Activates the lookup.
    sysTableLookup.performFormLookup();
}

then go the form data source of the field and then

over ride the look up method of the same and JUST CALL THE STATIC METHOD OF THAT TABLE LIKE

public void lookup(FormControl _formControl, str _filterStr)
{
    super(_formControl, _filterStr);
    SellingModelOKN::lookupInvoiceDayOKN(_formControl, "invoice day");
}


here we go our look up is ready......

but always try to create a look up by relation as it is more flexible...

Wednesday, 12 August 2015

how to use visual studio profiler

steps to use Visual Studio Profiler:

Note Visual Studio Profiler is available with Visual Studio 2010 Premium and Visual Studio
2010 Ultimate editions.

In Visual Studio, on the Debug menu, click Options And Settings.
2. In the left pane of the Options dialog box, click Debugging, and then click Symbols, and
ensure that the symbol file is loaded for the XppIL folder of the AOS that you want to profile.
(The profiling tools use symbol [.pdb] files to resolve symbolic names such as function names
in program binaries.)
3. On the Analyze menu, click Launch Performance Wizard to create a new performance session.
4. Accept the default setting of CPU Sampling, and point to the AOS that you want to profile, but
don’t start profiling right away.
5. Open Performance Explorer, right-click the top node of your session , and then
click Properties.



6. In the Properties window, navigate to Sampling and decrease the sampling interval either to
100,000 or 1,000,000 to get better results.
7. Prepare the process that you want to profile, and then click Attach/Detach to attach
to the
process (for example, the AOS).
8. When you are done profiling, click Attach/Detach to detach from the AOS.

After you finish profiling, Visual Studio generates a report that helps you understand the
performance
problem in detail, as shown in figure


strating a trace from x++ code

Start a trace through code instrumentation
You can use the xClassTrace class from the Tracing Cockpit to start and stop a trace. To trace the Sales
Form letter logic, see the following sample in \Classes\SalesFormLetter:
// Add
xClassTrace xCt = new xClassTrace();
// to the variable declaration.
// …code…
if (salesFormLetter.prompt())
{
xClassTrace::start("c:\\temp\\test1.etl");
xClassTrace::logMessage("test1");
xCt.beginMarker("marker"); // Add markers at certain points of a trace to
// increase trace readability. You can add
// multiple markers per trace.
salesFormLetter.run();
xCt.endMarker("marker");
xClassTrace::stop();
outputContract = salesFormLetter.getOutputContract();
numberOfRecords = outputContract.parmNumberOfOrdersPosted();
}
// …code…
In the call to xClassTrace::start, you can use multiple parameters to specify the events to trace or
whether you want to use circular logging, among other things. To find out which keyword equals
which parameter, put a breakpoint in the class SysTraceCockpitcontroller\startTracing and start a trace
from the Tracing Cockpit with various events selected

Monday, 10 August 2015

Cannot select a record in Order lines (SalesLine). The SQL database has issued an error. SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'XYZ'.

when we get error like this :

Cannot select a record in Order lines (SalesLine).
The SQL database has issued an error.
SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'XYZ'.
T1.SALESID,T1.LINENUM,T1.ITEMID,T1.SALESSTATUS,T1.NAME,T1.EXTERNALITEMID,T1.TAXGROUP,T1.QTYORDERED,T1.SALESDELIVERNOW,T1.REMAINSALESPHYSICAL,T1.REMAINSALESFINANCIAL,T1.COSTPRICE,T1.SALESPRICE,T1.CURRENCYCODE,T1.LINEPERCENT,T1.LINEDISC,T1.LINEAMOUNT,T1.CONFIRMEDDLV,T1.RESERVATION,T1.SALESGROUP,T1.SALESUNIT,T1.PRICEUNIT,T1.PROJTRANSID,T1.INVENTTRANSID,T1.CUSTGROUP,T1.CUSTACCOUNT,T1.SALESQTY,T1.SALESMARKUP,T1.INVENTDELIVERNOW,T1.MULTILNDISC,T1.MULTILNPERCENT,T1.SALESTYPE,T1.BLOCKED,T1.COMPLETE,T1.REMAININVENTPHYSICAL,T1.TRANSACTIONCODE,T1.TAXITEMGROUP,T1.TAXAUTOGENERATED,T1.UNDERDELIVERYPCT,T1.OVERDELIVERYPCT,T1.BARCODE,T1.BARCODETYPE,T1.INVENTREFTRANSID,T1.INVENTREFTYPE,T1.INVENTREFID,T1.INTERCOMPANYORIGIN,T1.ITEMBOMID,T1.ITEMROUTEID,T1.LINEHEADER,T1.SCRAP,T1.DLVMODE,T1.INVENTTRANSIDRETURN,T1.PROJCATEGORYID,T1.PROJID,T1.INVENTDIMID,T1.TRANSPORT,T1.STATPROCID,T1.PORT,T1.PROJLINEPROPERTYID,T1.RECEIPTDATEREQUESTED,T1.CUSTOMERLINENUM,T1.PACKINGUNITQTY,T1.PACKINGUNIT,T1.INTERCOMPANYINVENTTRANSID,T1.REMAININVENTFINANCIAL,T1.DELIVERYNAME,T1.DELIVERYTYPE,T1.CUSTOMERREF,T1.PURCHORDERFORMNUM,T1.RECEIPTDATECONFIRMED,T1.STATTRIANGULARDEAL,T1.SHIPPINGDATEREQUESTED,T1.SHIPPINGDATECONFIRMED,T1.ADDRESSREFRECID,T1.ADDRESSREFTABLEID,T1.SERVICEORDERID,T1.LINEDELIVERYTYPE,T1.SHIPCARRIERID,T1.SHIPCARRIERACCOUNT,T1.SHIPCARRIERDLVTYPE,T1.SHIPCARRIERACCOUNTCODE,T1.SALESCATEGORY,T1.DELIVERYDATECONTROLTYPE,T1.ACTIVITYNUMBER,T1.LEDGERDIMENSION,T1.RETURNALLOWRESERVATION,T1.MATCHINGAGREEMENTLINE,T1.SYSTEMENTRYSOURCE,T1.SYSTEMENTRYCHANGEPOLICY,T1.MANUALENTRYCHANGEPOLICY,T1.ITEMREPLACED,T1.RETURNDEADLINE,T1.EXPECTEDRETQTY,T1.RETURNSTATUS,T1.RETURNARRIVALDATE,T1.RETURNCLOSEDDATE,T1.RETURNDISPOSITIONCODEID,T1.DELIVERYPOSTALADDRESS,T1.SHIPCARRIERPOSTALADDRESS,T1.SHIPCARRIERNAME,T1.DEFAULTDIMENSION,T1.SOURCEDOCUMENTLINE,T1.STOCKEDPRODUCT,T1.ITEMPBAID,T1.PSAPROJPROPOSALQTY,T1.PSAPROJPROPOSALINVENTQTY,T1.PDSEXCLUDEFROMREBATE,T1.RETAILVARIANTID,T1.LRTISSUETYPE,T1.LRTTRANSACTIONTYPE,T1.LRTINVENTTRANSIDTO,T1.LRTINVENTDIMIDTO,T1.LRTRENTALFROMDATETIME,T1.LRTRENTALFROMDATETIMETZID,T1.LRTRENTALTODATETIME,T1.LRTRENTALTODATETIMETZID,T1.LRTBUNDLEID,T1.LRTOPERATINGUNITVALUE,T1.LRTOPERATINGUNITUNITID,T1.LRTPERCENTOFBASEPRICE,T1.LRTTIMEUNITQTY,T1.LRTTIMEUNITPRICE,T1.LRTOPERATINGUNITPRICE,T1.LRTTARIFFUNITID,T1.LRTPRICEACQUISITIONCODE,T1.LRTRENTALWORKTIMEID,T1.LRTPRICESCALETYPE,T1.LRTPRICESCALE,T1.LRTPRICINGITEMID,T1.LRTOPERATINGUNITEXCEPTEDQTY,T1.LRTPRICESCALEID,T1.LRTPROJECTLEVEL1,T1.LRTPROJECTLEVEL2,T1.LRTPROJECTLEVEL3,T1.LRTPROJECTLEVEL4,T1.LRTCOMPANYSRCCOUNTRY,T1.LRTISCONSTRUCTION,T1.LTMPUSHQTY,T1.LTMPULLQTY,T1.LRTTAXGROUPRENTAL,T1.LRTISRENTALINVOICE,T1.LRTRENTEDITEMID,T1.LRTRENTALISSUEREFID,T1.LRTRENTALRECEIPTREFID,T1.LRTRENTALISSUETYPE,T1.LRTRENTALRECEIPTTYPE,T1.LTMSHIPMENTFRAMEWORKID,T1.LRTSALESQUOTATIONINVENTTRANSID,T1.LRTSALESORDERSTATUSID,T1.LRTACCRUEDRENT,T1.LRTRENTALSTOCKTRANSIDSALES,T1.LWSISWARRANTYCASE,T1.LTMREQUESTEDDELIVERYUNTIL,T1.LTMREQUESTEDDELIVERYUNTILTZID,T1.LTMREQUESTEDDELIVERYFROM,T1.LTMREQUESTEDDELIVERYFROMTZID,T1.LRTISLWSORDERTABLE,T1.LRTISPREPAYMENT,T1.LRTLINEDISCRENTALOPERATINGUNIT,T1.LRTLINEDISCRENTALTIMEUNIT,T1.LRTLINEPERCRENTALOPERATINGUNIT,T1.LRTLINEPERCRENTALTIMEUNIT,T1.LRTREPLACEMENTITEMID,T1.LRTREPLACEMENTINVENTSERIALID,T1.LRTINSURANCEREFINVENTTRANSID,T1.LRTISTIMERECORDPOSITION,T1.LRTESTABLISHEDSTAFFACTIVITYID,T1.LRTINCLUDEDINALLINCLUSIVE,T1.LRTORIGINVENTTRANSID,T1.LRTINVENTTRANSIDRETURN,T1.LRTREFUNDINGLINE,T1.LRTPERMISSIONVALIDFROM,T1.LRTPERMISSIONVALIDFROMTZID,T1.LRTPERMISSIONVALIDTO,T1.LRTPERMISSIONVALIDTOTZID,T1.LRTRENTEDINVENTDIMID,T1.LRTPROCESSREASONID,T1.LRTTRAFFICMEASURESSTATUS,T1.LRTTRAFFICMEASURES,T1.LRTESCORTSTATUS,T1.LRTESCORT,T1.LRTAPPROVALSTATUS,T1.LRTAPPROVAL,T1.LRTSETTINGUPPERSONNELREQUIRED,T1.LRTPROCESSINGSTATUS,T1.LRTRESPONSIBLEINVENTSITEID,T1.LRTRESPONSIBLEDEPARTMENTID,T1.LRTFREEOFCHARGE,T1.LRTLINENUM,T1.LRTLINEGROUPINGTYPE,T1.LRTRENTALPRICECHANGETYPE,T1.LRTRENTALSTOCKTRANSCONDITIONS,T1.LRTRENTALSTOCKIDREFRENTALSWAP,T1.LRTGROUPHEADERPRICECALCULATED,T1.LRTPRICEORIG,T1.LRTTIMEUNITPRICEORIG,T1.LRTORIGCALCGROUPTABLEID,T1.LRTCALCGROUPID,T1.LRTLINENUMSORTABLE,T1.LRTTRANSPORTDIRECTIONTYPE,T1.LRTPARENTINVENTTRANSREFID,T1.LRTISSERVICE,T1.LRTSERVICEREFINVENTTRANSID,T1.LRTCALCULATESALESFEECOLLECTION,T1.LRTSERVICEOBJECT,T1.LRTSERVICETYPE,T1.LRTVALIDITYPERIOD,T1.LRTCOVERAGEPERCENT,T1.LRTCALCULATIONPRICE,T1.LRTCALCVALID,T1.LRTBLOCKEDFORINVOICING,T1.LRTCLOSURERENTALTERMREFRECID,T1.LRTISSITE2SITETRANSFER,T1.LRTPRINTSUBITEM,T1.LRTPRINTPRICE,T1.AGREEMENTSKIPAUTOLINK,T1.DLVTERM,T1.MCRORDERLINE2PRICEHISTORYREF,T1.PDSBATCHATTRIBAUTORES,T1.PDSITEMREBATEGROUPID,T1.PDSSAMELOT,T1.PDSSAMELOTOVERRIDE,T1.PSACONTRACTLINENUM,T1.RETAILBLOCKQTY,T1.LTMISORDER,T1.SELLINGMODELIDOKN,T1.PAYMMODEOKN,T1.PAYMSCHEDIDOKN,T1.PAYMTERMIDOKN,T1.CSIPDMALTERNATEEXTENDED,T1.CSIPDMALTERNATESPLITMETHOD,T1.CSIPDMITEMIDORIG,T1.CSIPDMLCPEFFECTIVITYDATESOVERRIDE,T1.CSIPDMREVISIONRULEOVERRIDE,T1.CSIPDMREVISIONUSEUPSPLITMETHOD,T1.DIRECTDEBITOKN,T1.MONTHSOKN,T1.MONTHLYFEEOKN,T1.GAMECONVERSIONTERMOKN,T1.NUMBEROFWARRANTYCONVERSIONSOKN,T1.PCPRICEMODELOKN,T1.AVERAGERENTALFEEPERDAYSYC,T1.CUSTOMERNOTIFICATIONDATEOKN,T1.DIRECTDEBITAUTHORITYRECEIVEDOKN,T1.DIRECTDEBITAUTHORITYRECEIVEDOKNTZID,T1.ESTIMATEDINSTALLATIONDATEOKN,T1.FULLYEARUPFRONTLICENSEBILLINGOKN,T1.GAMECATEGORYOKN,T1.GAMEPROGRAMNUMBEROKN,T1.GAMETHEMEOKN,T1.LICENSEBILLINGSOREQUIREDOKN,T1.ORDERLINESTOPPEDOKN,T1.REGULATORNOTIFICATIONDATEOKN,T1.REGULATORYNOTIFIEDDATEOKN,T1.REVENUEMONTHOKN,T1.RRTERMIDSYC,T1.CURRENTMONTHSOKN,T1.NONCURRENTMONTHSOKN,T1.TOTALMONTHSBILLEDOKN,T1.TOTALMONTHREMAINGOKN,T1.ACTUALINSTALLDATEOKN,T1.MODIFIEDDATETIME,T1.MODIFIEDBY,T1.CREATEDDATETIME,T1.CREATEDBY,T1.RECVERSION,T1.PARTITION,T1.RECID,T1.LRTNOTICE,T1.LRTPROCESSREASONCOMMENT FROM SALESLINE T1 WHERE (((PARTITION=?) AND (DATAAREAID=?)) AND ((SALESID=?) AND (((SALESSTATUS<>?) AND (SALESSTATUS<>?)) OR (SALESDELIVERNOW<>?))))

solution:
go to the SQL database 
select * from SALESLINE
select * into SALESLINE_TMP from SALESLINE
drop table SALESLINE

run above 3 instructions and then synchroize the table from ax.
later restore the table tmp to sales line main.


if the above  steps dont help then 

follow the instructions 
in this link :
http://alexondax.blogspot.com.au/2014/08/ax-2012-tfs-solving-update-conflicted.html


intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...