I have a Record Variable "jdRecServiceItems" and when i press a button on the Customer Form
i have the following code :
jdRecServiceItems.SETVIEW('SORTING(Customer No.,Ship-to Code,Item No.,Serial No.) WHERE (Customer No. = FILTER(' + "No." + '))');
It works fine when i use the English Language , but when i choose to Change the Language to Greek from the menu Tools\Language when i press
the button i take the following error message :
"A ')' is missing from TableView Sorting(Customer No.,Ship-to Code,Item No.) WHERE (Customer No. = FILTER(Cust0003))"
As i said it works fine when Navision runs with English Language with no errors
Cust0003 is the value of the field "No." in the customer table.
Any ideas ? :?
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If you look at the output from rec.getview, you will notice that it is language dependent, since it is using field captions and not field names. To make it language independent you should use field numbers.
I'll recommend that you try making a dummy codeunit and set the filters you wish and then call rec.getview(false). Then use this format instead, it is language independent.
Peter
Why not use SETCURRENTKEY along with SETRANGE/SETFILTER?
It is really strange, and the error can be reproduced.
Have you posted it to the partnersource as a support request to get MBS opinion?
Arhontis
https://forum.mibuso.com/search
I posted an incident to MBS and the responce was:
Arhontis
https://forum.mibuso.com/search
Arhontis
https://forum.mibuso.com/search
It is even documented in the on-line help: and PS: Please don't consider it a bug. CRM is using this to show Saved Criteria filters using the current user's language. It does it by storing the views using fieldnumbers and then on the form convert to fieldcaptions. Pretty neat if you ask me ;-)
Peter
If I understand correctly you suggest to create codeunit with a function that returns the GETVIEW(false) string of a given record. Right?
Must I create a function for every table I need convertion of the string? Cause the SETVIEW or SETFILTER is table specific.
I am not sure I get it... Could you be a little more specific?
Arhontis
https://forum.mibuso.com/search
I just wanted you to make a simple codeunit like this: Then you would notice that the output is like this: And when I run it using Danish settings: "My" method works every time. It depends how you are to use it if you can use the method described by Arhontis. If you store this string in a database it will fail later if a user is using a different language. So I will recommend that you the fieldnumbers instead of fieldcaptions unless you wish to show it to the user. Anything that is stored anywhere should be language independent. So back to the question from fb which you haven't answered yet... :-)
Later edition: SORRY!!! I thought the last post was from johndim and not from Arhontis. My mistake :-(
Peter
Thanks for the explanation, I have done this experiment and GETVIEW(FALSE) is a nice workarount...
Personaly I always use SETCURRENTKEY and SETRANGE/FILTER and haven't got any problems yet...
If I am to use SETVIEW in the future I would build a func of my own, change the language temporarily, do a SETVIEW, get the GETVIEW(FALSE), change the lang back and do the SETVIEW with field numbers...
Nice trick pdj!
Arhontis
https://forum.mibuso.com/search
i tried Arxontis solution and it worked
when i find some time i'll see the rest recomendations as well
Thank you all again =D>