Search This Blog

Wednesday, 17 December 2014

How to Validate the Special Characters from the given String in Ax 2012

Hi,

Today I would like to share a X++ code to validate the special characters from the given string

static void RemoveSpecialCharacters(Args _args)
{str stringVar1,stringVar2;

//String with special characters and numbers
stringVar1= test!@#$%^&*(){}[]|\+-;,.?/~`12344;

//String without Special characters and  numbers
stringVar2=strRem(strAlpha(stringVar1),"1234567890");

if(stringVar2!=stringVar1 )
{          throw error("Enter Valid data");
}else
{            info("ok");
}
}
Happy Daxing...........
 

Thursday, 4 December 2014

X++ code to get the Phone Number of the Delivery Address in the Purchase Order in AX 2012

Hi,
 
Today I would like to share you , how to get the phone number of the Delivery Address in the Purchase Order.
 
static void getphoneNumber(Args _args)
{
 
PurchTable purchTable;
 
LogisticsLocation logisticslocation;
 
LogisticsPostalAddress logisticsPostalAddress;
 
select purchTable where purchTable.PurchId=="000059";
 
select logisticslocation where logisticslocation.ParentLocation ==
LogisticsPostalAddress::findRecId(purchTable.DeliveryPostalAddress).Location;
 
info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Description);
 
info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Locator);
 
}
 
Happy Daxing.........