Display option field on report

NAV_2009_SP1

I am trying to display an option field onto a report “Inventory Valuation”. I have created globals and some code below… My first problem is that the returned value is not the correct record for the Item No. When i ran the debugger the returned value is some random Item number so i am not getting the right item number associated with the record. Also the option field displays the number and not the name of the option .

LifeCycle… DataType=record, SubType ItemLife cylce. and

LastLifeCycle data type = option.

in the custom table ‘Item Lifecycle’ the fields are Item No., Effective Date, Lifecycle Status, Comments

Item - OnPreDataItem()

LifeCycle.SETCURRENTKEY(“Item No.”, “Effective Date”) ;

Item - OnAfterGetRecord()

IF LifeCycle.FINDLAST THEN

LastLifeCycle := LifeCycle.“Lifecycle Status”

ELSE

LastLifeCycle :=0 ;

Where did you put filter on LifeCycle table based on Item No.?

I am not sure how to put a filter on the LifeCycle table in the report I can get close based on some other code i am looking at in the report but it links to the item ledger entry table. With the lifecycle table there is only the Item No. that i can put the filter on…

ItemLedgEntry.SETRANGE(“Item No.”,“No.”);

LifeCycle.SETRANGE(“Item No.”, “?”)

LifeCycle.SETRANGE(“Item No.”, “No.”); ??