Hi guys.
Lets say I need to fill a field "Values" on Table1 to be like this:
"Values" = Text1 + Text2 + Text3 + ... + TextN.
Where Text1...etc are fields in another table, Table2.
Table1 and Table2 have one common field, lets call it "Key" where there can be same values of this field in both tables.
How and where should I put a code for this.
I tried to place this code OnAfterGetRecord trigger of Table1 but it doesn't work
Table2.SETRANGE ("Key","Key");
Values :=' ';
IF Table2.FIND ('-') THEN
REPEAT
Values := Table2.Text1 + ' ' + Table2.Text2 + ' ' + Table2.Text3;
UNTIL
Table2.NEXT = 0;
0
Answers
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
and Currpage.update(FALSE)
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Those values are Country Code and Country Name from that Table2.
It needs to read these if they have same "key" as on Table1.
ex.:
Table2:
Key: A1
C.Code: BE
Name:Belgium
Key: A2
C.Code: GB
Name:Great Britain
Key: A1
C.Code: SI
Name:Slovenia.
And if there is a "key": A1 on Table 1,
I need to show there:BE-Belgium, SI-Slovenia,... from table 2
But it only shows first one: BE-Belgium
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Something like that is normally only used for display purposes and not for filtering so if that is the case then I would create a function in table 1 which goes through the records in table 2 with the same key field and concatenates the values as required and then returns this text. The value can then be shown on page/form/report as required simply by calling the function.
BTW the reason you are only getting the values from the first table 2 record is that you are rebuilding the value for each iteration of the loop. Instead of...
...it should be...