Simply create display methods in the methods of your form and call them.
This blog discusses tips that would be useful in Microsoft Dynamics AX! I have made a note of all pointers that I thought would prove to be useful for someone at some point in future! Please feel free to drop in your comments and feedback on any article here!
mercredi 20 avril 2011
mardi 19 avril 2011
How to create method find in a table
Follow this example:
static Thy_DimensionsNivels find(ProjCategoryId _projCategoryId, boolean _forUpdate = false)
{
Thy_DimensionsNivels thy_DimensionsNivels = null;
;
Thy_DimensionsNivels.selectForUpdate(_forUpdate);
if (_projCategoryId)
{
select firstonly thy_DimensionsNivels
index hint DimensionIdx
where thy_DimensionsNivels.ConcatNum == _projCategoryId;
}
return thy_DimensionsNivels;
}
static public InventDim find(InventDimId inventDimId, boolean _forupdate = false)
{
InventDim inventDim;
;
if (inventDimId)
{
if (_forupdate)
inventDim.selectForUpdate(_forupdate);
select firstonly inventDim
index hint DimIdIdx
where inventDim.InventDimId == inventDimId;
}
return inventDim;
}
Thy_DimensionsNivels thy_DimensionsNivels = null;
;
Thy_DimensionsNivels.selectForUpdate(_forUpdate);
if (_projCategoryId)
{
select firstonly thy_DimensionsNivels
index hint DimensionIdx
where thy_DimensionsNivels.ConcatNum == _projCategoryId;
}
return thy_DimensionsNivels;
}
Or this one in the inventDim Table
static public InventDim find(InventDimId inventDimId, boolean _forupdate = false)
{
InventDim inventDim;
;
if (inventDimId)
{
if (_forupdate)
inventDim.selectForUpdate(_forupdate);
select firstonly inventDim
index hint DimIdIdx
where inventDim.InventDimId == inventDimId;
}
return inventDim;
}
How to create method exist in a table
Follow this example
{
boolean found;
;
found = (select firstonly
RecId
from
Thy_dimensionsNivels
where
Thy_dimensionsNivels.ConcatNum == _concatNum).RecId != 0;
return found;
}
lundi 18 avril 2011
How to update vendor addresses in Dynamics AX
static void J1A_UpdateVendAddressType(Args _args)
{
VendTable vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable dirPartyTab;
Address addTab;
;
ttsbegin;
while select vendTab
join dirPartyTab
join forupdate addTab
where vendTab.PartyId == dirPartyTab.PartyId &&
addTab.AddrTableId == dirPartyTab.TableId &&
addTab.AddrRecId == dirPartyTab.RecId
{
if(addTab.Name == 'Birincil Adres')
{
addTab.type = AddressType::Payment;
addTab.update();
}
}
ttscommit;
}
How to import vendors to VendTable in Dynamics AX
Here are the steps:
1. Import vendor records with a PartyID (I used vendor id)
2. Import records into the DirPartyTable
Type = Organisation
Language=EN-GB (for example)
PartyID=VendTable.AccountNum
3. Import records into the Address table (export dirpartytable to get recid)
AddrRecId=DirPartyTable.RecID
AddrTableId=2303
STREET=address (i.e added char(10)s in excel for carriage returns - I know
there are other ways)
4. Import records into PartyAddressRelationship (export address to get recid)
Status=active
PartyID = vendtable.partyid
5. Import records into PartyAddressRelationshipMapping (export
partyaddressrelationship to get recid)
addressrecid=address.recid
partyaddressrelationshiprecid=partyaddressrelationship.
vendredi 15 avril 2011
How to allow creating in a grid of a form only when choosing value of another field
Try this
{
if( InventFamilyId1.valueStr()!= "")
{
super(_append);
}
else
{
Warning("@THY101");
}
}
How to initilize a field in a form when all records in the grid are deleted
You can use this
public void delete()
{
super();
if (!Thy_InventItemPrintParameters::exist(Thy_InventItemPrintParameters.ItemId))
{
InventFamilyId1.text("");
InventFamilyId1.enabled(Noyes::Yes);
InventFamilyId1.mandatory(Noyes::Yes);
}
}
Inscription à :
Articles (Atom)