Need to diplay price

I’ve created the report using query but i need to add a field of Price for corresponding itemid…

How and where can i write the display method for that item…

Thanks in advance…

You can write a display method in report methods. Write a select on InventItemPrice (use new buffer in that method) and use all the fields in your query in the where clause.

display Price getprice()
{
InventItemPrice inventitemprice;
InventItemactivePrice item;
;
select inventitemprice where inventitemprice.ItemId==item.itemid;
return inventitemprice.Price;
}

is that right??

my query name is InventItemactivePrice…

How can i declare buffer for the query in report…

display Price getprice()
{
InventItemPrice item;
;
select Price from Item
where item.itemid == inventItemPrice_1.ItemId
&& item.InventDimId == inventItemPrice_1.InventDimId; //use other fields to get the related price
return inventitemprice.Price;
}

pastedimage1509531420912v1.png

the price field isn’t fetching the value, Kranthi

display Price getprice()

{

InventItemPrice item;

;

select Price from Item

where item.itemid == inventItemPrice_1.ItemId

&& item.InventDimId == inventItemPrice_1.InventDimId && item.CostingType==inventItemPrice_1.CostingType && item.PriceType==inventItemPrice_1.PriceType; //use other fields to get the related price

return item.Price;

}

pastedimage1509531563370v1.png

Try to debug and see.

debugger isn’t installed, kranthi:(

Try to use info in your code to check the value is there.

Also try using the Activation date in the select
item.ActivationDate == inventItemPrice_1.ActivatoinDate

I tried item.ActivationDate == inventItemPrice_1.ActivationDate but there is an error saying table doesn’t contain the field.

display Price getprice()
{
InventItemPrice item;
;
select Price from Item
where item.itemid == inventItemPrice_1.ItemId
&& item.InventDimId == inventItemPrice_1.InventDimId
&& item.CostingType==inventItemPrice_1.CostingType
&& item.PriceType==inventItemPrice_1.PriceType
&& item.ActivationDate==inventItemPrice_1.ActivationDate
&& item.createdDateTime==inventItemPrice_1.createdDateTime; //use other fields to get the related price
return item.Price;
}

i tried still the Price field in report showing value as 0.

Is that inventItemPrice_1 indicates buffer for query??

It is the name of the data source used in the query.
As you don’t have the debugger, try printing an info(to check if the field used in the select are having the right value)

insert 5 fields in group by of query : itemid, inventDImid, costingtype, pricetype, versionId
in field selection of query select above 5 fields only and remove max(activationdate) and max(cretedatetimedate)

in the display method

display Price getprice()
{
InventItemPrice item;
;
select firstonly Item
order by item.ActivationDate, item.createdDateTime desc
where item.itemid == inventItemPrice_1.ItemId
&& item.InventDimId == inventItemPrice_1.InventDimId
&& item.CostingType==inventItemPrice_1.CostingType
&& item.PriceType==inventItemPrice_1.PriceType
&& item.VersonId==inventItemPrice_1.VersonId

return item.Price;

}