I need to write a codeunit that will pick out non matching fields. The one of the fields has a datatype of code the other is an option and it has a one to many relationship( 1 option to many codes). I need this codeunit to find all records where these fields don't match and trigger a Boolean field to true so then the client can filter on it.
This is what I have written so far but it doesn't seem to trigger the Boolean field to true and I am unsure why..
Table1.RESET;IF Table1.GET(Table2."Code Field") THEN BEGIN IF Table2.Option<> Table1.Option THEN BEGINTable1."Boolean" := TRUE; END;END;Table1.SETRANGE("Boolean", TRUE);PAGE.RUN(PAGE::"Page1");
Table1 is bespoke for the codes to show which option goes with them and Table2 is general table which is where the data is kept for each record..
Please excuse me I am still a beginner..
I would suggest that you either use the Field table to check your fields, or as an alternative use RecordRef and FieldRefs, this way you have full access to the fields data types.