Any way to include all the characters in Text or any other data type variable?

Hi,

I have txtBody as Text(1024) type variable.

Ex:

txtBody := ‘Hi ADMIN,’;
txtBody := txtBody + FORMAT(CR,0,’’) + ‘The ticket number ’ +“Ticket No.” ;
txtBody := txtBody + ’ has been Created.’ + FORMAT(CR,0,’’) + ‘Other details are:’ ;

txtBody := txtBody + FORMAT(CR,0,’’) + 'Description: ’ + “Ticket Description”;

strCount:=STRLEN(txtBody); = 96

Here all datatypes are Text.

But i get the error “Overflow under type conversion of Text to Text”.

Is there any way or data type to include all the characters in txtBody.

Rather than building your string using concatenation as you’re doing, try using a combination of a Text Constant and the STRSUBSTNO function. The advantages include multi-language support, and cleaner, tidier code that’s easier to maintain. Take a look at the help information that’s available for the function, and look at any of the posting codeunits for examples of how they employ Text Constants.

Hi,

Actually i have to collect all the information from Rec.xyz in txtBody and pass this txtBody as a parameter to a

function say cuMail.NewMessage(txtToMail,txtCCMail,txtSubject,txtBody,’’,FALSE);

Please suggest me the best possible way.

Thanks.

Please reply if any one has any idea.

Thanks

When you have trouble try simplfying your code.

Instead of txtbody := txtbody + whatever abunch of times.

Give Each part it’s own variable.

TxtHeader := ‘Hello Admin’;
TxTNumber := //just the ticket # info
TXTDescription :=//Just the description part.

That way it’s easier to see the individual string lengths and see which part is too large.

Then you can combine them together. I’ll assume by this line (strCount:=STRLEN(txtBody); = 96)

that you think the TOTAL length is only 96 so it should fit into 1024.