Use of container in display method in AX
There may be requirement when we need to display certain things from multiple lines in to a single field
with comma separated, and it is just for viewing purpose(Sometime informative).
with comma separated, and it is just for viewing purpose(Sometime informative).
Ex:
In sales header you want to capture all the lines warehouses in a single field which should be separated in
comma.
comma.
Am going to add display method, Just add the below code in Table > SalesTable
Display Name Warehouse()
{
salesline salesline;
Container warehouse;
int i=0;
str strwarehouse;
;
strwarehouse='';
while select salesline where salesline.SalesId==this.SalesId
{
if(confind(warehouse,InventDim::find(salesline.InventDimId).InventLocationId)==0)
warehouse +=InventDim::find(salesline.InventDimId).InventLocationId;
}
for (i = 1 ; i <= conLen(warehouse) ; i++)
{
if(strwarehouse=='')
strwarehouse=conPeek(warehouse,i);
else
strwarehouse=strwarehouse+', '+conPeek(warehouse,i);
}
return strwarehouse;
}
And then drag this particular method in SalesTable form.
And once this display method is added in to the grid, we will be able to view our scenario.
Here it is:
So, the field ‘warehouse’ in header part of sales order represents the cumulative warehouse of lines.
No comments:
Post a Comment