Using requestform and option buttons to make Item report multilangual

danielbouwmeester
Member Posts: 22
Hello all!
I've a question: I have a report which uses among others the table Item as DataItem. I've created a nice Product Specifications report to send to customers, but now some international customers want them also. So, for me the challenge is to make it multilangual. I've used the captionML of all fields to translate the report, but now I want to set the language using a request form.
- I've created the form
- Declared in Globals the Option variable 'optionLanguage' and set the OptionSting 'NLD, ENU'
- I've inserted to Option Buttons and set the SourceExp to 'optionLanguage' and the Optionvalues of both the buttons to respectively 'NLD' and 'ENU'
- I've inserted a line of code on the OnOpenForm() action of the request form: 'OptionLanguage := 0;' to make the first button default
So now I need to retrieve the selected value from the form. But then I need to store the value into the variable 'optionLanguage'??? Or how do I continue from here. I know that I can control the language of the report with the line of code 'CurrReport.LANGUAGE := ....'. But how do I get from where I am now to the point that it is a working request form! Please help me out! Thanks in advance!
I've a question: I have a report which uses among others the table Item as DataItem. I've created a nice Product Specifications report to send to customers, but now some international customers want them also. So, for me the challenge is to make it multilangual. I've used the captionML of all fields to translate the report, but now I want to set the language using a request form.
- I've created the form
- Declared in Globals the Option variable 'optionLanguage' and set the OptionSting 'NLD, ENU'
- I've inserted to Option Buttons and set the SourceExp to 'optionLanguage' and the Optionvalues of both the buttons to respectively 'NLD' and 'ENU'
- I've inserted a line of code on the OnOpenForm() action of the request form: 'OptionLanguage := 0;' to make the first button default
So now I need to retrieve the selected value from the form. But then I need to store the value into the variable 'optionLanguage'??? Or how do I continue from here. I know that I can control the language of the report with the line of code 'CurrReport.LANGUAGE := ....'. But how do I get from where I am now to the point that it is a working request form! Please help me out! Thanks in advance!
"Make it idiot-proof and someone will invent a better idiot..."
0
Best Answer
-
I've made some small changes/improvements and think I solved it:
- Instead of removed the line of code from the OnOpenForm() trigger of the Request Form and added the line to the OnInitReport() trigger of the report. I changed it to 'OptionLanguage := OptionLanguage::NLD;' to set the default language.
- On the OnPreReport() trigger of the report I've added the line 'CurrReport.LANGUAGE := Languagerec.GetLanguageID('ENU');'. Now my report is running in English language.
- Now, I wanted to replace the 'ENU' parameter with the value of the selected Option Button. So first I replaced it simply with the name of the Option variable: 'OptionLanguage', but then I got some error about the fact that the requested parameter should be a CODE type, but I'm using an OPTION type. So then I've used the FORMAT function and this made the line like this: 'CurrReport.LANGUAGE := Languagerec.GetLanguageID(FORMAT(OptionLanguage));'. Now it is working fine and I'm going to do some finetuning, to make it look nicer!
Thanks everybody for the support!"Make it idiot-proof and someone will invent a better idiot..."5
Answers
-
Hi. Sounds like you need to pass data to the report and then run the report. If so please search MIBUSO How Tos for this. Neil0
-
Yes but the request form is part of the same report. So it is the same object, right? So I don't need functions to pass parameters? I only have to store the selected value of the Option variable 'optionLanguage' into a different variable?? (How do I do that and in which trigger of the request form?).
And after that I have to get the value in the OnPreReport trigger of the report?!
In the How Tos I only find procedures to pass parameters between different objects, but that's not the case, right? Sorry for all the questions!
Kind regards,"Make it idiot-proof and someone will invent a better idiot..."0 -
I've made some small changes/improvements and think I solved it:
- Instead of removed the line of code from the OnOpenForm() trigger of the Request Form and added the line to the OnInitReport() trigger of the report. I changed it to 'OptionLanguage := OptionLanguage::NLD;' to set the default language.
- On the OnPreReport() trigger of the report I've added the line 'CurrReport.LANGUAGE := Languagerec.GetLanguageID('ENU');'. Now my report is running in English language.
- Now, I wanted to replace the 'ENU' parameter with the value of the selected Option Button. So first I replaced it simply with the name of the Option variable: 'OptionLanguage', but then I got some error about the fact that the requested parameter should be a CODE type, but I'm using an OPTION type. So then I've used the FORMAT function and this made the line like this: 'CurrReport.LANGUAGE := Languagerec.GetLanguageID(FORMAT(OptionLanguage));'. Now it is working fine and I'm going to do some finetuning, to make it look nicer!
Thanks everybody for the support!"Make it idiot-proof and someone will invent a better idiot..."5
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions