Development Error... Language Problem

mxc
Member Posts: 42
I developed a new NAVISION report, using my native language (Portuguese). Since the boolean values in Portuguese are reflected in "Sim" and "Não" (Yes and No), in my C/AL there was something like:
SETFILTER(Open, 'Sim');
As you know, this means that I only wanted records with the field "Open" set to true.
When I later changed the NAVISION language to English and then tested the report there was the following error message:
'Sim' is not an option.
The existing options are:
No, Yes
What can I do to solve this problem? Is there a way to find the current language (I could then make an IF statement)?
Regards,
SETFILTER(Open, 'Sim');
As you know, this means that I only wanted records with the field "Open" set to true.
When I later changed the NAVISION language to English and then tested the report there was the following error message:
'Sim' is not an option.
The existing options are:
No, Yes
What can I do to solve this problem? Is there a way to find the current language (I could then make an IF statement)?
Regards,
Regards,
Manuel Xavier
Manuel Xavier
0
Comments
-
Try this
SETRANGE(Open, TRUE);
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Thanks, It worked...
Why doesn't SETFILTER accept the argument TRUE but SETRANGE does?Regards,
Manuel Xavier0 -
Because SETFILTER has a different syntax as SETRANGE. After the field, it expects a filter expression.
This will work also:SETFILTER(Open,'%1',TRUE);
From the C/SIDE Online-help:Record.SETFILTER(Field, String, [Value],...)
Record
Data type: record
The record that contains the field you want to filter.
Field
Data type: field
The field you want to filter.
String
Data type: text or code
The filter expression. A valid expression consists of alphanumeric characters and one or more of the following operators: <, >, *, &, |, and =. You can use replacement fields (%1, %2, and so on) to insert values at run-time.
Value
Data type: any
Replacement values to insert in replacement fields in the filter expression. The data type of Value must match the type of Field.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
When using SETFILTER, you have to filter using a string, not a Value. So, the translated Value (and the translated value for a boolean is Yes or No). When using SETRANGE, you set filters using Values (not translated).
e.g.
SETFILTER(MyOption, MyOption::Option) will NOT work, because an option expects an integer-value, and SETFILTER wants a string. So, you have to use SETFILTER(MyOption, '%1', MyOption::Option). Mapped to your problem, when you want to use TRUE or FALSE in a SETFILTER, then you probably have to use SETFILTER(Open, '%1', TRUE);
Off course, using SETRANGE in this case is much more appropriate ... . Just use SETFILTER when you want to apply a more complex filter on a field, like SETFILTER(MyField, '%1..%2', Number1, Number2). Filters like that are not possible with a SETRANGE.
Hope this explenation was satisfactory ... .0 -
Luc,
In your last reply, you wrote "From the C/SIDE Online-help:".
What online help?
Thanks.Regards,
Manuel Xavier0 -
When you are writing your C/AL code, press <F1>.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Just for future reference there is a multilanguage document that I believe is supplied on the product cd. It explains how to use multilanguage successfully in customizations and points out some pitfalls. This document was created in the first place to help the Navision team convert the non-multilanguage product into the Attain multilanguage version. Later it was distributed to help NSCs develop in Navision multilanguage situations.
One of the processes which uses a supplied tool finds all of the literals in the code. It puts in constants where the literals were and creates the contant definition with the literal. In this way the constant can have multiple languages associated with it whereas a literal (in single quotes) has the actual words of one language. Problem is this process changes these SetFilter literals such as 'Yes' so the next process is to manually put them back!
Anyway, this is just to point out there are some hooks when dealing with multilanguage and the multilanguage document can help avoid them.0 -
mxc wrote:I developed a new NAVISION report, using my native language (Portuguese). Since the boolean values in Portuguese are reflected in "Sim" and "Não" (Yes and No), in my C/AL there was something like:
SETFILTER(Open, 'Sim');
As you know, this means that I only wanted records with the field "Open" set to true.
When I later changed the NAVISION language to English and then tested the report there was the following error message:
'Sim' is not an option.
The existing options are:
No, Yes
What can I do to solve this problem? Is there a way to find the current language (I could then make an IF statement)?
Regards,
Guys,
Am I wrong if I'm telling you to always develop in the ENU (English) language? I think this way you will never have these kinds of problems. Or not?"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Hi
Emiel you are not wrong.
All development should be in ENU (English US) which will avoid this problem. Then you can add any languages you like to the captions and Text Constants etc...Answer the question and wait for the answer.0
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