SBX - Search With Button

SBX - Forum Post Title

How to split string value into multiple lines

Microsoft Dynamics NAV Forum

Sonia Alexander asked a question on 10 Jun 2019 1:47 AM
My Badges

Question Status

Suggested Answer

Hi experts, Hre i am trying to import comment lines using .CSV files but i want to split the comments into multiple lines if it exceeds the maxstrlen of the field. Please help

Reply
I Gusti Made Ari Permadi responded on 10 Jun 2019 4:35 AM
My Badges
Suggested Answer
IF STRLEN(Comment) > MAXSTRLEN(SalesCommentLine.Comment) THEN BEGIN
   i := 0;
   j := STRLEN(Comment);
   WHILE j > 0 DO BEGIN //Do loop Insert 
      SalesCommentLine.Comment := COPYSTR(Comment,(MAXSTRLEN(SalesCommentLine.Comment) * i) + 1,MAXSTRLEN(SalesCommentLine.Comment)); 
      j:= j - MAXSTRLEN(SalesCommentLine.Comment);
      i+=1;
   END;
END ELSE
  //Insert Normally
Reply
I Gusti Made Ari Permadi responded on 10 Jun 2019 4:35 AM
My Badges
Suggested Answer
IF STRLEN(Comment) > MAXSTRLEN(SalesCommentLine.Comment) THEN BEGIN
   i := 0;
   j := STRLEN(Comment);
   WHILE j > 0 DO BEGIN //Do loop Insert 
      SalesCommentLine.Comment := COPYSTR(Comment,(MAXSTRLEN(SalesCommentLine.Comment) * i) + 1,MAXSTRLEN(SalesCommentLine.Comment)); 
      j:= j - MAXSTRLEN(SalesCommentLine.Comment);
      i+=1;
   END;
END ELSE
  //Insert Normally
Reply

SBX - Two Col Forum

SBX - Migrated JS