Problem in table relation in customised tables

vyanku
vyanku Member Posts: 791
I create two tables.
1st table Student contains
student no. code 20
2nd table Book contains
book no. code 20
studentno code 20

Now when I am trying corelate these two tables by table relation property ,save the table.when I run that table .When I click on lookup button nothing is happend.
I am not able to understand where is the problem? ](*,)
What may be the problem? ](*,)

Answers

  • bostjanl
    bostjanl Member Posts: 107
    vyanku wrote:
    I create two tables.
    Now when I am trying corelate these two tables by table relation property ,save the table.when I run that table .When I click on lookup button nothing is happend.
    I am not able to understand where is the problem? ](*,)
    What may be the problem? ](*,)

    Do you have lookup form for table student? And have this form declared as lookup in table student?


    bles
  • vyanku
    vyanku Member Posts: 791
    Do you have lookup form for table student? And have this form declared as lookup in table student?
    I have form for student and book also.
    Why I should decleared this form as lookup in table student.?
    Why I am not able to get the lookup in table instead of form?
  • bostjanl
    bostjanl Member Posts: 107
    vyanku wrote:
    Do you have lookup form for table student? And have this form declared as lookup in table student?
    I have form for student and book also.
    Why I should decleared this form as lookup in table student.?
    Why I am not able to get the lookup in table instead of form?

    Having a form is not suficient. In table there is property LookupFormID. There you can set which form is used for lookup. Set this property,


    bles
  • bijaljambusaria
    bijaljambusaria Member Posts: 46
    You generally dont run the table to edit/ enter the data. You should use form instead of running table directly.
  • vyanku
    vyanku Member Posts: 791
    You generally dont run the table to edit/ enter the data. You should use form instead of running table directly.

    Yes ur right. But suppose when I insert a one field of vendorno in table and relate it by table relation.and when I run the table it suscessfully run and we can get the vendor no by lookup of vendorno. field in table
    If it is applicable with vendor field in the table then it should be applicable with another customised table field.
    Is it problem of customised table?
  • Mbad
    Mbad Member Posts: 344
    What tablerelation does on lookup is running the looupform that is in the looupformid property on the table it is related to, like Bostjanl stated. Your last post makes no sense to me at all.
  • bijaljambusaria
    bijaljambusaria Member Posts: 46
    vyanku wrote:
    Do you have lookup form for table student?
    Why I should decleared this form as lookup in table student.?
    Why I am not able to get the lookup in table instead of form?

    If you see navision standard, E.g. Vendor Table and Currency Field lookup. when you run the table and lookup from currency, it will open form and not table . So, it means navision standard does not allow to lookup to another table directly. You need to create form for that.
  • vyanku
    vyanku Member Posts: 791
    Thanks
    It works for field having datatype code.
    But now when there is field called
    Account type having datatype option
    In option property :-option strings :-customer,vendor,book
    Now When i select customer the next field shows me customer no. on lookup button just like in payment journal form.
    When I select vendor option the nest field shows me vendor no. on lookup button.
    But when I select Book option I dont get the book no. on lookup button as book is new customised table. :-k
    Now what can I do? Why I dont get the view by clicking lookup button?
    I cant change the property lookup in the form of that table as its datatype is option not code. :-k
    Is it means that it is problem of customised table? :-k
  • Mbad
    Mbad Member Posts: 344
    When using option fields like that you need to change the tablerelation to the right table. Look in table 37 on the field No. You will see there is an IF statement ragerding tablerelations.
  • vyanku
    vyanku Member Posts: 791
    I also write a case statement like
    Account type::book THEN BEGIN
    book.get("Book no.");
    END;
    

    But nothing happend.
  • vyanku
    vyanku Member Posts: 791
    Nay one got this type of problem???? ](*,) ](*,) :-k
  • Albertvh
    Albertvh Member Posts: 516
    As Mbad said

    When using option fields like that you need to change the tablerelation to the right table. Look in table 37 on the field No. You will see there is an IF statement ragerding tablerelations.

    This means that you must design your table select field account type view properties and drill down on the table relation and set your conditions there. :idea:
  • vyanku
    vyanku Member Posts: 791
    Will u please explain breafly?
  • Albertvh
    Albertvh Member Posts: 516
    Go to design the table that has the Account No. field in it
    Click view properties and scroll down to TableRelation
    Drill down on Value field and you should get

    Condition Table Field Table Filter
    Type=CONST(Customer) Customer
    Type=CONST(Vendor) Vendor

    Type=CONST(Book) Book

    the last line here you should add ensur that on you Book table you have defined a LookupFormId

    There should be no need to write code as you in your CASE statement
    remove it.
  • vyanku
    vyanku Member Posts: 791
    #-o
    Thanks
    Thats work
    \:D/