Hello!
I'm using NAV 4.0, SP1 and I have to change a report, to include only some lines which meet certain conditions. I'm working in the OnAfterGetRecord() trigger and I'm having problems with one of the rules I have to check.
I have to check the "G/L Account"."Account Type" field, in order to determine if the current record is Begin-Total. The application language is set to Italian, but I need the report to work even if the language were English, so I thought I could compare the "Account Type" integer value: how can I do that? :shock: Or is there a better/simpler solution to my problem?
You've probably guessed I'm a newbie and you're right, so please, if you know how to do that, could you add some code, please?
Thank you very much for your help!
1
Comments
i wrote "0" for the first option, you can sure use the other options
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Account Type"::"Begin-Total" is actually represented as "Account Type"::"0" internally - you can also write it like that when coding, it will automatically be converted into the corresponding OptionString text.
What this means is that if you change the OptionString for the field it will automatically change in your code as well.
Navision will always use the OptionString to represent the option value, never OptionCaption or OptionCaptionML. Therefore you'll have no problems dealing with different languages.
Senior NAV Developer
Elbek & Vejrup
Thank you very much, it worked...
I didn't know operator ::
also you will note that after saving the object, if you review your code, the number you wrote as the option, is automatically transfomed in the correspondent value in the option string...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
And same thing work for REPORT::"125" and FORM::"123" and DATABASE::"123"... ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Epimatic Corp.
http://www.epimatic.com
one more trick: you dont need to write all option string.
"G/L Account"."Account Type"::"B" also works
However one thing about your example:
Note that if there are multiple option values with 'B' as the starting character it will pick the first one (I've had that bite me in the ass before) - so you have to make sure that you type enough of the word that there is only one choice for the compiler to make.
Epimatic Corp.
http://www.epimatic.com
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!