Options

Opening pages from code after setting filters (NAV 7/8/9)

EvREvR Member Posts: 178
edited 2015-10-01 in NAV Three Tier
Hi all,

I'm sure this question has been asked before and I'm sure it is dead simple but I can't seem to figure out a basic page-flow.
Imagine the following situation:

- A new table, let's call it 'Item Image' consisting of the fields:
Item No. (code) (PK)
Index (int) (PK)
FileName (text)
Data (BLOB)
- A new list page called 'Item Image List' based on 'Item Image' containing the Index and FileName fields.
- A flowfield called 'Images' has been added to the 'Item' table, containing a count to get the number of 'Item Images' which have a relation to the current Item No.

What I want to do next, is display the 'Images' property on the Item Card. On click I want to open the 'Item Image List' page with a filter on the current Item No.
When inserting a new record in the 'Item Image List' page, I want it to be inserted with the Item No. that's currently in the filter from the Item Card.

What I'm doing at the moment is giving me issues while inserting new records. It does not honor the filter I've set:

(OnLookup behind the 'Images' field on the Item Card.)
ItemImage.SETRANGE("Item No.","No.");
ItemImageList.SETTABLEVIEW(ItemImage);
ItemImageList.RUNMODAL;

CurrPage.UPDATE;


Could someone point me to the preferred way of doing this IN NAV? Thanks!

Comments

  • Options
    vaprogvaprog Member Posts: 1,118
    Hi Erik,

    I cant find anything wrong with your code as you describe it. It should work. It does work with classic forms.

    I suggest, though, to set your Item Image List page as DrillDownPageID for the Item Image table, rather than programming a lookup on the page.

    Do you have any code in the OnInsert trigger on the page or table?

    Is the fault indeed with the inset into the Item Image Table or rather with the update of the FlowField on the Item Page?
  • Options
    DenSterDenSter Member Posts: 8,304
    Listen to vaprog and use a flow field. You can open the list page without writing a single line of code.
  • Options
    EvREvR Member Posts: 178
    Thanks for the suggestions.
    The reason I 'need' to do it through code, is that I want the count flowfield to be updated after inserting new records in the related list.
    If I use the drilldown page id, the flowfield does not update after closing the list. Which could be confusing to the end user.
Sign In or Register to comment.