Options

Table relation property problem

BmmBBmmB Member Posts: 9
Hi!
I'm using NAV 5.0 SP1. I added a new item under Type option field in Purchase Line table, let's name it SSS. User selects this type and in No. field chooses an account from a subrange of accounts from G\L Accounts table. In order to achieve this I added this table relation under corresponding property of No. field in Purchase Line table: if (Type = Type::
SSS) them G\L Accounts where No. = ((CONST)100000), or something similar (I don't have access to NAV right now). But when a user selects type SSS and then open the list of accounts in No. field, there is a complete unfiltered list of accounts and not only one set by the filter. It seemed easy enough to set and now I don't know what might be a problem. Would you please tell me what I'm missing? Thanks!

Answers

  • Options
    vijay_gvijay_g Member Posts: 884
    Table Filter in Table Relation property does not include filter applied on primary key(make sure there has not been applied any filter on primary key). if you apply filters except PK field(any other filed in table) it works fine.
  • Options
    BmmBBmmB Member Posts: 9
    Thank you vijay_g for your answer. I suspected that much. Is there some workaround I could use? Through coding or something?
  • Options
    vijay_gvijay_g Member Posts: 884
    yes.
    you have to write code for lookup(running a form using filter on PK filed) in onlookup trigger of related field. look at runmodal function.
  • Options
    BmmBBmmB Member Posts: 9
    Thank you again vijay_g for your answer, concise and right to the point. What you suggested works nice.
    I have just another question: I implemented lookup through code, but only for one type field (SSS one) and now default lookup for other types won't work anymore. Does coding in OnLookup trigger overrides default table relation options of all types? Any suggestions on solving this without actually writing lookup code for all other types?
  • Options
    ShedmanShedman Member Posts: 194
    Any code in the OnLookup-trigger of your table (or form for that matter) overrides the default lookup-functionality. So if you want to use it, you have to program it for all of the types.

    You could add a field to your G/L Accounts, which you can use to filter on in the tablerelation.
  • Options
    BmmBBmmB Member Posts: 9
    Thank you Shedman for the answer. I thought code would be more elegant, but adding a column includes much less work.

    Anyway, this is solved, thank you all for helping me out.
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    vijay_g wrote:
    Table Filter in Table Relation property does not include filter applied on primary key(make sure there has not been applied any filter on primary key).
    AFAIK, Filters on PK entered by TableRelation don't work only for the last field within the PK. Or is there any other issue we should consider that doesn't belong to the Filter?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
Sign In or Register to comment.