SQL eşitleme hatası veriyor
Kategori: X++
X++ is an object-oriented language with similarities to C#
DMF üzerine
TXT > Unicode
Sayılarda ondalık ayracı için virgül yerine nokta
Tarihte nokta yerine / işareti
bir ambardaki eldeki stok miktarına göre başka bir ambara transfer emri oluşturma
static void InventJournalFromInventOnHand(Args _args) { Query q; QueryBuildDataSource qbdsInventSum; QueryBuildDataSource qbdsInventDim; QueryRun queryRun; InventSum inventSum; InventDim inventDim, tmpInventDim, toInventDim; InventJournalTable inventJournalTable; InventJournalTrans inventJournalTrans; InventLocationId fromInventLocationId = "MRS_HASAR", toInventLocationId = "MRS_SATIS"; ; ttsbegin; InventJournalTable.clear(); InventJournalTable.initValue(); InventJournalTable.initFromInventJournalName("YourTransferJournalName"); InventJournalTable.insert(); q = new Query(); qbdsInventSum = q.addDataSource(tablenum(InventSum)); // RANGES //qbdsInventSum.addRange(fieldNum(InventSum, ItemID)).value(queryValue("TIM0288")); // GROUP BY qbdsInventSum.addGroupByField(fieldNum(InventSum, ItemID)); // SUM qbdsInventSum.addSelectionField(fieldNum(InventSum, PhysicalInvent), SelectionField::Sum); qbdsInventSum.addSelectionField(fieldNum(InventSum, PostedQty), SelectionField::Sum); qbdsInventSum.addSelectionField(fieldNum(InventSum, Received), SelectionField::Sum); qbdsInventSum.addSelectionField(fieldNum(InventSum, Deducted), SelectionField::Sum); qbdsInventSum.addSelectionField(fieldNum(InventSum, Registered), SelectionField::Sum); qbdsInventSum.addSelectionField(fieldNum(InventSum, Picked), SelectionField::Sum); // INVENTDIM qbdsInventDim = qbdsInventSum.addDataSource(tablenum(InventDim)); qbdsInventDim.relations(true); // RANGES qbdsInventDim.addRange(fieldNum(InventDim, InventLocationId)).value(queryValue(fromInventLocationId)); // GROUP BY qbdsInventDim.addGroupByField(fieldNum(InventDim, configId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, InventSizeId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, InventColorId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, InventSiteId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, InventLocationId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, InventBatchId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, inventSerialId)); qbdsInventDim.addGroupByField(fieldNum(InventDim, wMSLocationId)); queryRun = new QueryRun(q); while (queryRun.next()) { inventSum = queryRun.get(tablenum(InventSum)); inventDim = queryRun.get(tablenum(inventDim)); if ( inventSum.physicalInvent() > 0 ) { info(strfmt("%1 %2 %3", inventSum.ItemId, inventSum.physicalInvent(), tmpInventDim.InventBatchId)); inventJournalTrans.clear(); inventJournalTrans.initFromInventJournalTable(inventJournalTable); inventJournalTrans.ItemId = inventSum.ItemId; inventJournalTrans.Qty = inventSum.physicalInvent(); inventJournalTrans.TransDate = today(); tmpInventDim.clear(); tmpInventDim.configId = inventDim.configId; tmpInventDim.InventColorId = inventDim.InventColorId; tmpInventDim.InventSizeId = inventDim.InventSizeId; tmpInventDim.InventSiteId = inventDim.InventSiteId; tmpInventDim.InventLocationId = inventDim.InventLocationId; tmpInventDim.wMSLocationId = inventDim.wMSLocationId; tmpInventDim.InventBatchId = inventDim.InventBatchId; tmpInventDim.inventSerialId = inventDim.inventSerialId; tmpInventDim = InventDim::findOrCreate(tmpInventDim); inventJournalTrans.InventDimId = tmpInventDim.InventDimId; toinventdim = tmpInventDim; toinventdim.InventLocationId = toInventLocationId; toinventdim = inventdim::findOrCreate(toinventdim); inventJournalTrans.ToInventDimId = toinventdim.inventDimId; if(inventJournalTrans.InventDimId != inventJournalTrans.ToInventDimId) inventJournalTrans.insert(); else throw error ("inventdim tutarsız"); } } ttscommit; }
iş akışına onay/harcama sınırı parametresi ekleme
WorkflowDocument classına aşağıdaki metodlar eklenmeli
public class yourClassName extends WorkflowDocument { } > Class metodları protected void checkContext(tableId _tableId, RecId _recId) {; if (_tableId != tablenum(DRTExpenseTable)) // Your table name { // Workflow context table id reference: %1 is not valid throw error(strfmt("@SYS107963", _tableId)); } if (_recId == 0) { // Workflow context record id is zero. throw error(strfmt("@SYS107964")); } } public PurchReqSpendingLimitValueMST parmSpendingLimit(CompanyId _companyId, tableId _tableId, RecId _recId) { YourTableName yourTableName = YourTableName::findRecId(_recID); HRPLimitTypeTable limitTypeTable; HRPLimitTableMap limitTableMap; AmountMST limitValue; ; this.checkContext(_tableId, _recId); while select limitTypeTable where limitTypeTable.LimitType == HRPLimitType::Spending && limitTypeTable.DocumentType == HRPLimitDocumentType::CustCredit { limitTableMap = HRPLimitTableRelationship::getActiveLimitEmpl(limitTypeTable.LimitId, EmplTable::userId2EmplId(yourTableName.createdBy)); limitValue = max(limitValue,Currency::mstAmount(limitTableMap.LimitValue, limitTableMap.CurrencyCode)); } return limitValue; }
number sequence hatası
yeni bir modül yükledikten/oluşturduktan sonra aşağıdaki gibi bir hata alıyorsanız aşağıdaki kodu çalıştırıp AX’ı restart edelim. hatayı burda aldım Organization adm…>NumberSequences>Generate
“The NumberSequenceDatatype record for extended datatype ShippingCharge(sizin enum olacak) contains a reference to area 74 which does not exist. This may be the result of importing data inconsistent with the current build. Please reinitialize or reload the references.”
static void NumberSeqApplicationModule(Args _args) { NumberSeqApplicationModule::loadAll(); SysGlobalObjectCache::clearAllCaches(); appl.numberSeqGlobal().buildModulesMap(); }
The value xx is not found in the map.
numara serisi yapmak istediğinizde NumberSeqModule baseenum’a ekleme yaptığınızda “The value xx is not found in the map.” hatası alırsanız aşağıdaki metoda aşağıdaki satırı ekleyin.
/// <summary> /// Loads the number sequence grid with LabAx sequence numbers that need to be defined. /// </summary> void numberSeqPreInit() { runExecuteDirect = false; numberSequenceModules = [NumberSeqModule::LabAx]; numberSeqApplicationModule = new NumberSeqModuleLabAx(); // Define the right scope of the Number Sequence scope = NumberSeqScopeFactory::createDataAreaScope(); appl.numberSeqGlobal().numberSeqModulesMap().insert(NumberSeqModule::LabAx, numberSeqApplicationModule);//DRT MK NumberSeqApplicationModule::createReferencesMulti(numberSequenceModules, scope); tmpIdRef.setTmpData(NumberSequenceReference::configurationKeyTableMulti(numberSequenceModules)); }
Kaynak : https://rmdax2012.wordpress.com/2011/08/19/creating-isv-number-sequences/
Kullanıcı yetkileri için faydalı bir mini proje
Kuallnıcıların hangi menu’leri görebildiğini, o menu’nün yolu ile birlikte Ax’dan alamadığım için yaptığım mini geliştirme. umarım işinize yarar. isterseniz bu form ile yetkisini kaldırabilirsiniz.
kayıt düzeyi ve müşteri limiti
satışçılarınıza kayıt düzeyi ile müşteri düzeyinde kesişen yetkiler/kısıtlar verdiyseniz ve müşteri kredi limitinde kaçaklar oluşuyorsa; aşağıdaki kod satırı bu sıkıntınızı çözecektir.
böylece kredi limiti hesaplanırken kayıt düzeyini devreden çıkarmış olursunuz. müşterinin gerçek limiti ortaya çıkmış olur.
query.recordLevelSecurity(false);
startdate, enddate
forecastSales.StartDate = DateStartMth(dateMthFwd(forecastSales.StartDate, 0)); forecastSales.EndDate = endMth(dateMthFwd(forecastSales.StartDate, 0));
SQL Server COLLATION değiştirmek
setup.exe nin olduğu CD/klasörde ctrl + mouse sağ tuşu > komut penceresi aşağıdaki kodu yapıştır enter
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=instance adınız /SQLSYSADMINACCOUNTS=mrt\administrator /SAPWD=Şifreniz/SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS