I don't know if it's risky, or if it's a known habit of you guys, but sometimes i want to compare two record varibales and see if they're the same (i mean, through code). i also noticed that FORMAT function works with record variables.
Is there something wrong (or is there a better way to do it) in doing this?
IF FORMAT(mytablevariable1) = FORMAT(mytablevariable2) then
//record variables are pointing exactly to the same record
else
//one or more field values are different
i think it is self documenting and smart, but i'm probably missing something...is it possible that nav does not have a function to compare two record variables? :-k
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Answers
One thing I've seen done in the past is to use record ref variable and lookup the fields that are in the record and compare them. I think that's another way of comparing the records together....althought the format(recorda) = format(recordb) is probably just a good.
Epimatic Corp.
http://www.epimatic.com
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Epimatic Corp.
http://www.epimatic.com
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
If only we could have access to the 2Gb string data type like in C#/VS.Net!
Epimatic Corp.
http://www.epimatic.com
"If no length is specified for text variables, the length is unlimited."
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-object-specifications-limitations
FORMAT(Rec) limitation : If, when the system formats Value, the result is a value larger than the maximum length MAXSTRLEN method (Code, Text) of String, a run-time error occurs.
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-format-joker-integer-string-method
But MAXSTRLEN(TextVariable) = 2,147,483,647.
So, I compared:
if Format(Rec) <> Format(xRec) then
And it works on BC 16, OnPrem, AL extension.
You are addressing a 14 year old post.. a lot has changed.