show name

Hello!

I have a problem. I have two tables.

Name of first table: table_1
Columns of first table:
model code(20)
name text(50)
price decimal

Name of second table: table_2
Columns of second table:
no. code(10)
model code(20)
date DateFormula
description text(100)

I need to show for the user on the table_2 browse form the table_1 name. What is the key of this problem?

Thx

So, just to check.

You want a form that shows all the data from Table 2, is this a list or a card view?

Then “for each” record in Table 2, you should like to get the record from Table 1 where Table2.Model_code == Table1.Model_Code, and show the Table2 “Name” field?

Let me know if that is what you are trying to achieve.

/TH

Hello!

I have added a new column to table_1 (the name is model_name text(50)).
I put this code the OnAfterGetCurrRecord trigger of list form of table_2:

IF table_1_record.GET(model) THEN
model_name := table_1_record.name;

The code is working fine, but the model_name field of table_2 is filled only if I go to the next record.

I would like to make that if I run the list form of table_2 then the model_name of list form will be filled with name field of table_1 on the fly without record steping.

Thx.

In Table_2:
Add a new field, name text(50)
in the Validate trigger “No.” field add
(Table1 is a variable of record table_1
Table1.get(model);
name := table1.name;

Hello David!

I tried this code, and it is working but if I will change the name of table_1 then the name field of table_2 will not be changed automatically. What can I do in this problem?

Thx

OK, lets start again.

Step one is always to define the requirement. You can never build a good solution if you do not clearly define the problem and the requirement.

So go through from start to end, and then work out everythign that is needed, then once the probelm is defined, then start programming. Other wise you will just keep changing code over and over.

Hello!

It’s ok.

I have two tables. The concrete names are Manufactor and Kind of Music.
The tables structures:

Manufactor:
Field name Type
No. code(20)
Description text(30)
Length decimal
Kind of Music code(20) -------
|
Kind of Music | This is the relation between the two tables
Field name Type |
No. code(20)----------
Description text(30)

Both of two tables contains about 50-100 records. This was the basic case.

The client has asked me that he would like to see the Description field of Kind of Music on the
Card and List form of Manufactor. This is the basic problem.

First of all I have added a new field to the Manufactor which name is kind_of_music_name text(30).
What do I have to do that I will able to solve the problem?

Thx.

First - rename Manufactor.“Kind of Music” as -“KindOfMusicCode”; makes it easier to read and understand [:)]

Then you could make field kind_of_music_text a FlowField using this CalcFormula (using properties on the field): Lookup(“Kind of Music”.Description WHERE (No.=FIELD(KindOfMusicCode)))

Hello!

Cool :slight_smile: Working fine :slight_smile:

Thanks

And in OnValidate of the Kind of Music Code:
CALCFIELDS(Kind of Music Text);

That way the field is always updated when you validate the code field, regardless of which form you’re on, or where you use the record in code.