Coding Question equal....

Dear all,

How can I program code for the below requirements?

If “table A” is equal to “table B”, then “table C” equal to “Table B”.

If “table A” is NOT equal to “table B” then “Table B” equal to “Table A”.

I guess it isn’t difficult coding, but I have trouble with it now.

Could anyone help me?


You can’t do that on a table, but you can do it on a field. You can assign records, but not compare them as a whole.

IF RecordA.Field1 = RecordB.Field1 THEN BEGIN
RecordC := RecordB;

IF Record.Field1 <> Record.Field2 THEN BEGIN
RecordB := RecordA;

If you wanted to compare a whole record you would need to go field by field, or at the very least through the fields of the primary key.

The obvious omission here is that when the initial expression evaluates to FALSE, you would catch that by way of the ELSE leg of the initial IF statement. There is no need for two IF statements there.

Kaz, it seems that you need to go to a senior person in your organization for this type of help. For sure you need some education, and I would suggest that you follow the two development courses for NAV. You could probably also use an even more rudimentary programming course, to learn about code constructs, and generally applicable programming structures. I don’t know how you would get that type of training where you live, but over here I would go to a local community college.

Talk to your boss about getting the proper support within your company and the right training for you specifically.