I have two tables with a one to one relation. After creating a Tabular-Type form based on the first table, how can I display one field from the second table on the form? I have added an unbound textbox to the form but I don’t know how to synchronize the two tables and load the value for this field.
Create a global Variable of the second Table and set the SourceExpr of the unbound Textbox to field you want to display. In the OnAfterGetRecord-Trigger of the form you say: IF NOT yourrecord.GET(…) THEN CLEAR(yourrecord); Hope this helps, Frank
you have two possibilities: 1. create a flowfield which lookups to the field in the other table using your 1:1 key 2. write a trigger which lookups the value and returns a text in your form. then write the name of the trigger in the sourceexpr of the blank textfield. if you need the information only in one case solution 2 is better … else if you need the information in other parts too you should think about solution 1.
What is the correct code to do the table lookup (for the 2nd example)? The two tables are related by the field “No.”. The form is based on the table “Sales Line” and I need to return the value of “Name” from the “Customer” table. Thanks so much for your help! I’m new to Navision and without any documentation it’s tough learning C/Side!
- create a field in sales line like “Sell-to Customer Name” Type:Text Length: 30 (must be the same propties as in the lookup field !) 2. change the property “Field Class” to FlowField 3. move to property “CalcFormula” and open the assist formular by clicking the button […] 4. select: method=lookup; table=customer; field=Name; tablefilter: field = No., type = field, value = “Sell-to Customer No.” 5. now exit all the assist forms by using ok AND NOT ESC ! 6. now it should work … by the way … the tables are not linked by “No.” generally cause the “No.” in Sales Line is the item no. e.g. and the “No.” in customer is the customers number
Thank you for all the suggestions! I have implemented it as a flowfield and it’s working fine.