Get the item's first date price value

In sales Price window, I set filter Starting date to 12/25/2015 in the options.

For the Item 1,

I set Unit Price for the Starting Date 05/30/2014 and 12/25/2015

I have two columns in my table.

In 1st column I want to get Unit Price for 12/25/2015.

In 2nd column I want the first start date of the that item. That is Unit Price for 05/30/2014.

As I applied filter I get only value for 12/25/2015. But I want to get Price for 05/30/2014. because this is the First listed Price for that item.

I write the code in SalesPrice - OnAfterGetRecord()

IF “Sales Price”.GET(Item.“No.”) THEN
StartDateSales := “Sales Price”.“Starting Date”;

But I’m not getting the StartDateSales value. Any Suggestion?

Hi Ramesh,

Try this,

"Sales Price".SETFILTER(“Item No.”,Item.“No.”);

IF “Sales Price”.FINDFIRST THEN

StartDateSales := “Sales Price”.“Starting Date”;

Where you want to show the result?

I don’t think this’ll work in SalesPrice - OnAfterGetRecord()

Hi Ramesh,

In your code it doesn’t seem like you actually passing any item no in GET function as it is not initialised so no parameter is passing it wont go inside IF condition…

is that you want to filter the value of a specified item No. then why don’t you use the SetRange or setfilter in Onpredataitem… the you would directly get only records that have same Item no and you can look for Starting date…

like salesprice-- Onpredataitem

“Sales Price”.SETRANGE(“Sales Price”.“Item No.”,‘itemNoFilter’);