NAV 2013 R2. Filter in table and in SubPage

delaghettodelaghetto Member Posts: 89
edited 2014-05-07 in NAV Three Tier
Hello!

Please help me solve this situation:

- I have a custom table called "header"
- I have another custom table called "lines" where there is a Field "ItemID".
- I have a Page called "HeaderPage"
- I have another Page called "HeaderLines1" (Type ListPart)
- I have another Page called "HeaderLines2" (Type ListPart)

In the Header page, I have HeaderLines1 and HeaderLines2 as a subpages. Now, the ItemID filter is different in HeaderLines1 and HeaderLines2. So in each subpage, I go to the ItemID field and put the filter in the TableRelation property.

The problem is that I can put any value, like 'blablabla' in the field, and it doesn't do any validation to see if the Item exists.

If I put the filter in the TableRelation property of the "Lines" table, the filters in the subpages are ignored.

¿How can I correctly do this? Having 2 subpages with the same table as datasource and different filters?

Thanks.

Comments

  • Rob_HansenRob_Hansen Member Posts: 296
    I think you need to call in a senior resource for some help here on understanding concepts. The TableRelation property is a field-level property used to drive lookups and data validation...it has nothing to do with the filters used to determine what data shows on subpages. It's also incredibly rare that you would define a TableRelation on a field at the page level (apart from a variable on a request page)...as a general rule it should always be used at a table level.

    You need to use the subpageview/subpagelink properties on the header page to restrict the data shown on the subpages...or code in each subpage (or the header page) to dynamically apply filters if there's more logic involved.

    My big recommendation is still to spend some time with an experienced resource here...hearing that you're trying to use the TableRelation property to apply filters has me thinking you'll just play around with settings in the other properties until you get it (somehow) working. You can create some ugly solutions if you don't fully understand what exactly you're doing.
  • delaghettodelaghetto Member Posts: 89
    OK, I agree that it's best to have the TableRelation at the table level and not in the subpages, so in my ItemID field in the lines table I put the relation.

    The thing is that if I use the subpageview/subpagelink, I can only filter by "Item No." I cant filter for example by "Item Group"

    ¿So how could I filter by "Item Group" in the subpage without using the TableRelation property in the page field? ¿What kind of code I need to put?

    The way I'm able to make it work is by putting the TableRelation in the subpage and by Code using "Onvalidate" in the table, I check if the user is putting an invalid Item by hand.

    I hope there is a better way of doing this.
Sign In or Register to comment.