RecordRef use and benefit?

Hi there, I am a pretty new Navision developer so sorry if the question sound like a total beginner :wink: I have to do a PowerPointShow about the use and benefit of RecordRef’s. My Problem is that I never even used a RecordRef. Google doesn’t come up with a lot I could use so I thought maybe you could help? Where is the difference between Record and RecordRef even? Can you tell me some really easy and small examples of the use of RecordRef? Any Help is appriciated really! Thx in advance Acid

Well we do have a beginers forum for this reason. [:D] Basically a record ref allows you to access a field by its tabel and field number, rather than having to define it specifically. It has no real value in terms of Navision as an ERP application, but is extremely usefull for doing repetative tasks that are not ERP based. It can also be usefull if you want to write you own tools to work in Navision with. In case a/ an example might be where you want to create a field level security tool. You could create a table that stores the User ID, Table ID, Field ID,a nd and an option to allow Read/Modify etc. This way, you would only need to write one set of code to do the task. To do this for only a few tabels would not make sense, since it is always more work to set up, but once you are using the same piece of code on multiple unrelated tables, then the overhead pays off. In terms of the second item, you could easily write a user configurable tool that would allow the user to create an excel spread sheet form any table data in navision, since the user could have asetup table tohat defines the layout of the fields, and which table the data comes from. Much like Account Schedules. But to be honest, if you have a need for RecRef, then you will know very fast once you start coding. If you don’t need them then don’t use them. Of course remember that once you write code using RecRef, it will be totally unreadable. In summary though, i can not see any advantage/disadvantage of RecRef vs Record defined variables. I can though see scenarious where you MUST use RecRef, and scenarious where you SHOULD use normal variables.

Learn the basics of Record References in Navision. A little codeunit with some code and explanation on how to use RecordRef’s in Navision. RecordRef Sample http://www.mibuso.com/dlinfo.asp?FileID=276

Hi and thx for your answers allready. @savatage99: I allready had that link but I must admit I didn’t really get what it does. @David Singleton: This alleady helps. But if you could now give me one little example where you, as you say, MUST use a RecordRef. That would help me a lot for my PowerPointShow. Thx allready and sorry for hitting the wrong forum.

That link is to an upload from Emiel, and Emiel I think knows his stuff, if that doesn’t help you, then I am not sure what you need. As I said a good example would be say field level security where you need to be able to generate an error message if a user accesses a prohibited field. You need to keep in mind that there is no “Advantage/Disadvantage” of either system, they are differnt, and in one case you need one, on the second case you need the other. Try to search http://www.mbsonline.org/forum/search.asp on recref, you should find some examples. I really though think that you should not be doing such a presentation without a clear understanding of what you are expected to achive. I cna not for the life of me see why you need to present this? Is it part of a sales demo? In whcih case, just let the client know that they have both options, and end of story.

Ok now after a little research… do I get it right that RecordRef is almost the same as Record but instead setting the table in the global properties you can assign it at any point of the code?!

Sorta kinda, imagine a type var in C++ compared to a Pointer var. Basically if you define a RecRef, you can then poitn it at any field in any table that you want (with limits of course). But keep in mind, don’t compare them, they are differnt things, Its like comparing a screwdriver and a hammer, sometimes you need a screwdriver and sometimes you need a hammer. Of course you can often get a screw loose with a with a hammer, and you can always use a screw driver to hit things, but its best to use each what its designed for. PS you can use this in your presentation if it helps.

haha thx a lot! That made my day :wink: But I think I’ll get along now. Thx for your great help.