STRSUBSTNO bug or feature

I just got some strange error using STRSUBSTNO:

The text ‘…’ in STRSUBSTNO parameter no. 1 is too long.

Surprise : Is the string I give already longer than 1024 chars? But shouldn’t I have got an error when assigning that value to my variable that I sent into STRSUBSTNO?????

I was wondering if STRSUBSTNO was still limited to 250 chars like the older versions of Navision.

So created a global variable of type text of  1024 chars.

And I run this code :

t := strsubstno(padstr(”,300,’x'),’z');

=> No error. Was the error I got in some other place. Weird….

t := strsubstno(padstr(”,1024,’x'),’z');

=> ERROR. At least I am sure it was not in some other place, but why 300 was ok?

So there is some limit. Lets search for it.

t := strsubstno(padstr(”,1000,’x'),’z');

=> ERROR

t := strsubstno(padstr(”,900,’x'),’z');

=> ERROR.

To make a long story short :

t := strsubstno(padstr(”,511,’x'),’z');

=> This works

t := strsubstno(padstr(”,512,’x'),’z');

=> ERROR.

Conclusion : If your input string in parameter 1 is longer then 511 characters, you get an error!

But why is this the case??????

Now I can understand that if you put in a string of 1024 chars and substitute something to a longer string will give an error. But why already giving an error at 512 characters?

Specially if the error would be this:

String %1%1%1%1%1%1%1%1%1%1%1%1%1%1%1%1%1%1%1%1%1 is too small for insertion of %# fields.

This error message appeared because:
No.: 1
Value: …….

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word

Create a new blog and join in the fun!