Hi All,
I have written a codeunit which does some processing and at the same time displays the progress of processing by using a 'ProgressBar' variable of Dialog data type.
I have used following text constants
TEXT008 : Synchronising Products and Stock
TEXT009 :#1#########################\@2@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Note the total no. of '#' used in TEXT009 is 26
Here is my code to open the dialog and update '1 'in TEXT009
ProgressBar.OPEN(TEXT008 + TEXT009);
ProgressBar.UPDATE(1, StockKeepingUnit."Location Code" + ' / ' + StockKeepingUnit."Item No.");
.......
The 'StockKeepingUnit' is a record variable of 'StockKeeping Unit' table and it has following field definitions:
Item No. Code 20
Location Code Code 10
When i run the codeunit, the progress bar displays the value of '1 'as
StockKeepingUnit."Location Code" + ' / ' + StockKeepingUnit."Item No." however for some records it gives me error
"The length of source exceeds the size of destination buffer".
I am not sure how do we decide the no. of '#' we keep in the Text constant TEXT009.
Say if 'Location Code' assumes max 10 char's and if 'Item No.' assumes max 20-char's then does it mean that i have to keep 33 '#' char's in TEXT009
i.e. 10 for 'Location Code'
3 for ' / '
20 for 'Item No."
or is it the case that i have to keep double no. of '#' then the expected max. no. of char's to be displayed?
i.e. 33*2 = 66
Any idea?
Regards,
Hemant
Answers
Why is this error generated?
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
The error is still getting reproduced.
I have now updated TEXT009 to total no. of '#' equal to 27 and the Update command as below:-
Note that i have removed spaces before and after '/' in Update command.
I have kept total no. of '#' as 27 because in my case "Location Code" can be max. 10 char's and Item No. can be max 16 char's
Hence 10+1+16 = 27.
But still the error is reproduced.
I turned on the debugger and it stops at the Update command. I noticed that this happens only when Item No. contains max 16 char's.
For all other value less than 16 char's there is no error.
???
Regards,
Hemant
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Please beware that the '\' character is translated into the Linefeed and Carriage Return characters. (10+13).
That is probably why you are getting the error. Your calculation should be 10+2+16 = 28.
Hope this helps.
Regards,
Willy
Thanks for your reply.
Please note that i have used a forward slash('/') and not a backward slash('\') hence there is no question for a linefeed.
There is one thing which i pasted incorrectly. My apologies.
It is actually.
I even doubt the Open() which opens the Progress bar displaying Item No. as max 16 char's long which later on the Update() changes to LocationCode/ItemNo
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Try testing different lengths and shortening your @ to a much smaller size, and see if it works. Also test different text lengths on a basic Dialog and see when it is overloaded.
"Profanity is the one language all programmers know best."
What is your NAV version and Build No.?
Anyway,
- How many language captions do Text008 and Text009 have?
- Do you have items with CR/LF in the item No.?
Try changing the following code to You might also try this: I don't know why it should make a difference but what the heck!
But as einsTeIn.NET wrote: Same here. Maybe it is a problem of the client. Try another NAV build.
FD Consulting
I tried changing to and the problem got resolved.
FDickschat, thanks for your suggestion.
Although the problem got fixed i couldn't realize the exact cause since everything works fine without doing the above changes if StockKeepingUnit."Item No." is < 16 char's.
Thanks to all concerned.
Regards,
Hemant
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
But it is good to know that when opening a dialog with a fieldvariable, it might change the buffer to that lenght.
|To-Increase|