Comparing records

Hello everybody. I have a little problem (besides my english), I need to compare two records from the same table. What I did first, was enter in a single string all the data from the first record (separating columns with a ‘|’), and did the same in another string with the second record, and then compared the two strings. It worked this way, but I was thinking if there isn’t another way to compare two records. Thanks in advance!

I use Excel: select the two (or more) records in the table-browser (or in a form), copy from Ax, paste into Excel. And to make it easier to read and compare, use Paste/Transpose in Excel.

Thanks very much, but what I’m trying to do is Axapta to tell me when two records are equal, something like: boolean comparerecords(tablerecord1, tablerecord2) Returns true if they are equal, false if not. Of course, the recid could be different. I’ve programmed this method to compare two BOM lines. What I did is what I explained before, inserting every column on a string and then comparing the strings. But I wonder if there isn’t a better way to do this.

Hi. This is a more “professional” solution : custtable c1,c2; dicttable d = new dicttable(tablenum(custtable)); dictfield f; int i; boolean areTheSame = true; ; c1 = custtable::find(‘4001’); c2 = custtable::find(‘4001’); for(i=1;i<=d.fieldCnt();i++) { f = new dictfield(tablenum(custtable),d.fieldCnt2Id(i)); if (f.isSystem()==false) { if (c1.(d.fieldCnt2Id(i))!=c2.(d.fieldCnt2Id(i))) { areTheSame = false; break; } } } print areTheSame; pause; u can change the cust num to 4001 & 4002 to see the diference. Ciprian

Great! This is what I was looking for! Thank you very much!

Hi, … or you could use the equal() table method. static void Job1(Args _args) { custtable c1,c2; ; c1 = custtable::find(‘4001’); c2 = custtable::find(‘4001’); info(strfmt("%1",c2.equal(c1))); }