I've recently seen a rash of situations where people are putting hidden characters into fields in NAV.
Specifically, they are getting Carriage Returns and Line Feeds into things like Invoice Numbers, Addresses, Names, etc...
We do a lot of extracting of data for analytical purposes, alot of which goes to flat files for exchange with corporate systems and warehouses.
When these files are created, they are screwed up because the bad data causes an premature break, adding extra lines and causing data exchange jobs to fail.
It's nearly impossible to actually type in a Line Feed or Carriage Return by hand, accidentally.
What we've found is that users are copying and pasting from websites (for addresses, etc...) and that is carrying along these hidden characters.
Has anyone else had this problem?
0
Comments
Might not be the best way but you can check on entry of the field
"Your Field" - OnValidate()
Unfortunately sould like alot of fields they are pasting into. That's why I was thinking of cleaning it up on export. :-k
http://www.BiloBeauty.com
http://www.autismspeaks.org
another solution is: try with this(i've never used it, maybe you want to test it)
http://www.mibuso.com/dlinfo.asp?FileID=1011
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
BUT...it doesn't do anything for CODE fields.
And, the first problem I encountered was on the Vendor Invoice No. field, which is a CODE field.
Is there a similar function that handles input to all Code fields?
You can modify your personalization like this:
Bye
Matteo
To see what I mean, just open Notepad and type "TEST" followed by a the enter key. Then select the whole text (with Ctrl+A) and paste it into a NAV text or code field... - you will see some extra characters (namely CR and LF) at the end of the string, when the input field in NAV is highlighted.
Since (as you already mentioned) it is nearly impossible to input CR/LF manually (not even with Alt+010 or Alt+013, etc.), I would concern this as a bug. There is a principle philosophy about copy and paste: It should not be possible to paste something that could not be entered manually or by means of a "legal" method.
Thanks. I understand the scope of the problem. Websites just happen to be where we are getting the majority of our issues.
In either case, the solution above fixes all the Text fields....but I still need a solution for the CODE fields.
Is there a way to intercept the function that applies the UPPERCASE to Code Fields? If so, I could add the appropriate code there....I assume not though.
http://www.BiloBeauty.com
http://www.autismspeaks.org
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Here is a sample code snippet to prevent the user from modifying code fields with "illegally" pasted characters - provided you are not using the standard "Change Log" functionality (otherwise the code had to be modified...):
1.) Put the following code in the beginning of the method GetGlobalTableTriggerMask in Codeunit 1: This will cause NAV to call the method OnGlobalModify every time an arbitrary record is modified by the user.
2.) Put the following code in the beginning of the method OnGlobalModify in Codeunit 1: Here, illegalString is a text variable of suitable length, containg the "illegal" characters you want to test. Field is a record variable for the Field-Table (virtual table no. 2000000041), fRef is a FieldRef variable.
Be sure to restart your NAV client after modifying Codeunit 1 for changes to take effect.
One disadvantage of the above method (besides evtl. decrease in performance) is that the error is thrown not until the record is to be modified, causing all evtl. inputs in other fields to be lost. The advantage of course is that you can check all code fields in all tables with little coding effort. The method can be extended (if necessary) for insert and/or rename transactions. Instead of throwing an error it is also possible to remove the illegal characters automatically (without notice for the user). This can be achieved with the following modification:
100 MakeSpecial (DateFormula, RecordID, TableFilter)
200 MakeSpecialFilter
101 MakeBoolean
201 MakeBooleanFilter
102 MakeOption
202 MakeOptionFilter
103 MakeInteger
203 MakeIntegerFilter
104 MakeDecimal
204 MakeDecimalFilter
105 MakeDate
205 MakeDateFilter
106 MakeTime
206 MakeTimeFilter
107 MakeText
207 MakeTextFilter
109 MakeCode
209 MakeCodeFilter
110 MakeBinary
210 MakeBinaryFilter
111 MakeBLOB
211 MakeBLOBFilter
112 MakeBigInteger
212 MakeBigIntegerFilter
113 MakeDuration
213 MakeDurationFilter
114 MakeDateTime
214 MakeDateTimeFilter
115 MakeGUID
215 MakeGUIDFilter
Did not test them all but just know the IDs when they are called.
You are the Best! :thumbsup:
In Fu MakeText I added the below code to remove CR/LFs ages ago. Now I added Fu MakeCode (ID 109) with the same code and there are no more CR/LFs in the DB \:D/ Another good reason to call all the old customers again and make them a little happier.
FD Consulting
Where do I specify the ID Number for the new function? Where are the ID Number's for Functions located in general. Sorry if this is basic. Thanks.
Edit: and on the next page already a reply from Luc ...
Nice little improvement, that is going to save me a lot of grief
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
i do this because sometimes systems which consume my data require NULL as a string instead of the actual null or empty value.
the code is yours if u like. just pm me for it.