Information about tables relations

snsnsnsn Member Posts: 23
Hello
I have form and now i want to now if there is any tables relation in this form, if it has tables relation then i want to know wich table is related to onother

261559304c4d86b2233ff.JPG
1.JPG 87.9K

Comments

  • matttraxmatttrax Member Posts: 2,309
    Are you talking about the table to which the form is bound? (As in what table all of the data comes from). Then design the table, view the properties, and look at the one called SourceExpr.

    Are you talking about the relationship between a specific field and another table outside of your form? Then once you know the table in the SourceExpr property, design that table from Object Designer and look at the TableRelation property for the field.
  • ElenaNAVElenaNAV Member Posts: 9
    Hello,
    If yoy go to the Designer of that form and ask for the form's Properties you have what you need on the SourceTable field.
  • matteo_montanarimatteo_montanari Member Posts: 189
    snsn wrote:
    Hello
    I have form and now i want to now if there is any tables relation in this form, if it has tables relation then i want to know wich table is related to onother

    261559304c4d86b2233ff.JPG

    Hi

    if you are a developer and you want to find "by code" a custom relation between a second table and your table, you can try to look at "field" virtual table, BUT if your custom table is linked to a second table with a relation condition, you will see "0" like no relation.

    For example:
    "Sales Line" "No." is relationed with GL account, resources, items, etc based on "Type" value. If you look on "Field" table, the relation is "0".
    "Sales Line" "sell to customer no." is relationed with "customer" table. On "field" Table you can see "18".

    You can use a recordref&FieldRef on a full database and then hope to find all relations.
    For example:
    sales line "Order " "101000" "10000" type = "item".
    fieldref := recordref.field(6);
    "fieldref.relation" will be "27"

    If you want only view relation between your table and secondary tables, look at "relation" fields property of your table.

    bye

    Matteo
    Reno Sistemi Navision Developer
  • snsnsnsn Member Posts: 23
    On this picture there are textboxes and one matrix box and on the sql server exists database with tables yes? I know that these textboxis bounded to "item" table in database, but i do not know in wich table is bounded to this matrix box (Sales code,Unit Prace,Unit of Measure code,Starting date), do you understand me?
  • mrsamrsa Member Posts: 35
    table 7002 "Sales price"
  • snsnsnsn Member Posts: 23
    Thanks to all for helping
    mrsa
    How did you know that this was table 7002 "Sales price"? and can i see how is relationship between these two tables ("Item" and "Sales price")
  • mrsamrsa Member Posts: 35
    I know that from expirence (frequently used table in NAV).

    If you have developer licence you can put focus in a subform (if your focus is on master form you would get data from master form), press CTRL + F2, and then propeties, in soure table property you can see name of table.
  • snsnsnsn Member Posts: 23
    Ok thank you
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Eto wrote:
    ...
    if you are a developer and you want to find "by code" a custom relation between a second table and your table, you can try to look at "field" virtual table, BUT if your custom table is linked to a second table with a relation condition, you will see "0" like no relation.

    Matteo
    It is not necessarily true. In case of conditional relation you will see 0 if you use virtual table Fields. But you can still find related table in such a case, but relation needs to be tested on particular record (as it can be different per each record)

    so instead of
    "10000" type = "item".
    fieldref := recordref.field(6);
    "fieldref.relation" will be "27"
    
    try this:
    SalesPrice.FINDFIRST;// I'm assuming that filters are already set
    recordref.gettable(SalesPrice); 
    fieldref := recordref.field(2);
    
    message('Sales Code field is related to table %1', fieldref.relation);
    
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • AndwianAndwian Member Posts: 627
    snsn wrote:
    Thanks to all for helping
    mrsa
    How did you know that this was table 7002 "Sales price"? and can i see how is relationship between these two tables ("Item" and "Sales price")

    Being your cursor placed like in the screenshot, tap the Ctrl+F8 to do the Zoom, there you can see the table Name on the Zoom window. It should be "Sales Price - Zoom".

    This can be done if you have certain permission. Try to log as SA.
    Regards,
    Andwian
Sign In or Register to comment.