Field Caption on Runtime.

I have read around in the forums and searched for changing the caption of a field when u open a form. What i mean is this: Two different customers are running on the same database. Customer A would like the caption on itemnumber to be “Car” but customer B would like the caption to be “trailer”. My first thought was that in OnOpenForm()or another trigger i could do a check on the userid and set the fieldcaption from a predefined table with various captions. But this seems not so work in runtime. Anybody out there know a way to change caption during runtime or is this impossible? Regards Frode Dahl aimit as

You just need to remember to update the field after changing it. It works fine.

Hi Frode, if you’re using Navision Attain, you can use the captionclass property. The captionclass property calls function “CaptionClassTranslate” which is found in Codeunit 1. Add your specific code to the end of the function and you should be able to achieve what you require. Check the captionclass property on any global/shortcut dimensions for an idea about how the function should be called. Im not sure if the implementation of CaptionClassTranslate is country specific, but in the UK, parameter 1, options 1 and 2 are used for Dimensions and VAT captions respectively. If you were to add a third option into the case statement, you would be able to call it from the captionclass property using ‘3,MyOptionshere’. CASE CaptionArea OF ‘1’ : EXIT(DimCaptionClassTranslate(Language,CaptionRef)); ‘2’ : EXIT(VATCaptionClassTranslate(Language,CaptionRef)); ‘3’ : EXIT(MyCaptionClassTranslate(Language,CaptionRef)); <------New Line! END; Regards, Edward Peggs

If I were you, I would use a CaptionClass in the same range where you are allowed to add tables, so: CASE CaptionArea OF ‘1’ : EXIT(DimCaptionClassTranslate(Language,CaptionRef)); ‘2’ : EXIT(VATCaptionClassTranslate(Language,CaptionRef)); ‘50000’ : EXIT(MyCaptionClassTranslate(Language,CaptionRef)); END; Remember that new CaptionClasses may be added to the W1 version, which will make upgrading more difficult if you use the same number range!

Yes that is a good point, I will have to remember that if I ever need to modify captionclasses! Regards, Edward.

You could define a function inside the form called SetCaption, which would contain the code to set the caption to what you want,then define the form as a variable in the calling object, it would go something like this: Record.RESET; Record.SETFILTER([Filter Statement]); MyForm.SetCaption([pass variable(s) if necessary); MyForm.SETTABLEVIEW(Record); MyForm.RUN;

Thanx for all replays… I looked deep into the captionclass function and found out that it works perfect. Again… thnx for all the replays. And enjoy the last of the summer before it is to late. Soon winter time here in Europe! Frode