Report Filter Field Remains Blank after Lookup

We have implemented a custom report which is based on the item and sales price tables. The users filter on item hierarchy when using the report. THe hierarchy is based on item category code product group code item class code item sub class code There is no problem when the users assign values (lookup) to the item category code and product group code fields . However when they assign values (lookup) to the item class code and item sub class code fields the filter fields remain blank. The correct values etc are visible in the lookup. If I manually type the values in the filter field, the filters work fine on the report. It appears that the lookup assignment is not working. Has anybody any ideas why the lookup and assign filter functionality does not work on these fields? Note : The two fields in question (Item Sub Class Code and Item Class Code) are custom fields.

Do you have used the Table Relation in the table to define the lookup, or is it code on the OnLookup trigger? It looks like this relates to the topic that has been raised a couple of days ago (http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=16446). Saludos Nils

Hi Nils, It is defined as a relation in the table.

There is actually code behind the on lookup event. it may well refer to the article you have linked to. I have posted the code for examination. When debugging, it appears to run all the code as expected and assign the value to “Item Class Code”. It just does not appear on the parameters form of the report. ItemClassGroupLookupForm.LOOKUPMODE:=TRUE; ItemClassGroupLookupForm.EDITABLE:=FALSE; ItemClassGroup.SETRANGE(“Product Group”, Rec.“Product Group Code”); IF (Rec.“Product Group Code” = ‘’) OR NOT ( ItemClassGroup.FIND(’-’) ) THEN BEGIN ItemClassGroup.RESET; ItemClassGroup.SETRANGE(“Item Category”, Rec.“Item Category Code”); ItemClassGroup.SETRANGE(“Product Group”, ‘’); IF (Rec.“Item Category Code” = ‘’) OR NOT ( ItemClassGroup.FIND(’-’) ) THEN BEGIN ItemClassGroup.RESET; ItemClassGroup.SETRANGE(“Item Category”, ‘’); ItemClassGroup.SETRANGE(“Product Group”, ‘’); END; END; ItemClassGroupLookupForm.SETTABLEVIEW(ItemClassGroup); IF ItemClassGroupLookupForm.RUNMODAL = ACTION::LookupOK THEN BEGIN ItemClassGroupLookupForm.GETRECORD(ItemClassGroup); “Item Class Code” := ItemClassGroup.Code; END; If I comment out all this code and just have the line “Item Class Code” := ‘ZZZ’; in the lookup event, the ‘ZZZ’ value is still not assigned.

As soon as you have any line of code in the OnLookup trigger, even it is deactivated with “{” and “}”, or any variable defined locally in that trigger, Navision will ignore the “Table Relation Lookup”… as mentioned in the other post, any code within the OnLookup will be ignored by the OnLookup selection on the RequestFilterFields in the report. Therefore, either place those fields in the RequestForm, where you can place the code on the respective triggers, or try to use the standard table relation. Not sure, but looking through your code, it should be possible to build some table relation with conditions to handle this situation, where the related fields are blank… Saludos Nils

Can you post the table structure of your Item Calss and Item Sub Class including their primary key fields here ?