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


find the realtion vetween 2 tables by x++ code

Please find the link for finding relation between 2 tables by code.

https://lalitoberoi.wordpress.com/2014/08/29/how-to-find-relation-between-two-tables-from-x-code/

intercompany PO multiple product receipt by x++

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