Text length error

sunnyksunnyk Member Posts: 280
Hi Guys,
i wrote this code to capture extended text lines based on the standard text code selected
IF StandardTextCode <> '' THEN BEGIN
  ExtTextLine.RESET;
  ExtTextLine.SETRANGE(ExtTextLine."Table Name",ExtTextLine."Table Name"::"Standard Text");
  ExtTextLine.SETRANGE(ExtTextLine."No.",StandardTextCode);
  ExtTextLine.SETFILTER(ExtTextLine.Text,'<>%1','');
  IF ExtTextLine.FINDSET THEN
    REPEAT
      IF (STRLEN(Stdtext1) + STRLEN(ExtTextLine.Text)) <= 1000 THEN
        Stdtext1 := Stdtext1 + ' '+ExtTextLine.Text
      ELSE IF (STRLEN(Stdtext2) + STRLEN(ExtTextLine.Text)) <= 1000 THEN
        Stdtext2 := Stdtext2 + ' '+ExtTextLine.Text
      ELSE IF (STRLEN(Stdtext3) + STRLEN(ExtTextLine.Text)) <= 1000 THEN
        Stdtext3 := Stdtext3 + ' '+ExtTextLine.Text
      ELSE IF (STRLEN(Stdtext4) + STRLEN(ExtTextLine.Text)) <= 1000 THEN
        Stdtext4 := Stdtext4 + ' '+ExtTextLine.Text
    UNTIL ExtTextLine.NEXT = 0;


END;

Now when i run the report i got this message The text in the report exceeds the limit allowed by 110 characters.
When i deleted some lines from extended text conatining ~~~,*** or
its working fine.

Why is it so?

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Your error message doesn't sound like that's the problem, but maybe the length of Stdtext1 (or one of the other Text variables) and the length of ExtTextLine.Text are together exactly 1000 characters. If so, you would get an overflow because you add an extra blank space.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • sunnyksunnyk Member Posts: 280
    Hi Einstein,
    The problem is in the code only. its wrong. Thank you.
  • SavatageSavatage Member Posts: 7,142
    Without much detail it appears your checking to see if these two texts are Less than or equal to 1000.
    if so, you're adding them together, but you are also new adding a new space [+' '+] so if was 1000 now it's 1001. So assuming STDTEXT1 length is 1000 you now have an overflow.

    IF (STRLEN(Stdtext1) + STRLEN(ExtTextLine.Text)) <= 1000 THEN
    Stdtext1 := Stdtext1 + ' '+ExtTextLine.Text
  • sunnyksunnyk Member Posts: 280
    Hi,
    But this error comes when i place the textbox to capture StdText1+' '+Stdtext2. suppose if i place this text box in the fotter of a dataitem then rest of the things are printing but afater this footer the report is breaking. i checked the Max length property also of the text box and set the autoenter to yes.
    the total no of characters in my extended lines are nearly 1051.
    And when i place 2 texboxes to take stdtext1 and stdtext2 respectvely it working fine.
    if this was an overflow error than half of the report will not print. Am i right?
  • SavatageSavatage Member Posts: 7,142
    as said with little detail it's hard to say.
    What's happening if the value is >?
    The code appears not to handle this.

    If this plus that <= to 1000 the str1 has a value if it's not you go right to str2 with no more regards to str1.

    Have you thought about using an array?
    Do you have code to clear the Stdtext(1-4) after it's run though?
  • sunnyksunnyk Member Posts: 280
    Hi Harry,
    I doubt that i am trying to insert data in a text box of length more than 1056. I tried to put condition well before the variables have data of length 1000. so i modified my condition as stdText1 < 900 but keep the size of variable 1000. So whenever i used source expression of the textbox as StdText1 its working fine but when i use the sourceexp as StdText1 + StdText2 then only i get this error.
Sign In or Register to comment.