BSTR that exceeds string buffer length

wheresjustin
Member Posts: 26
Hi all,
I am trying to get some data from the type 'Microsoft XML, v4.0'. IXMLDOMNode by calling the propery 'text' that returns a BSTR.
eg.
ThisNode.text;
However, there are times when this BSTR will be longer than the 1024 character limit of a Text variable, and I get the following error:
"the length of the text string exceeds the size of the string buffer"
I have been trying to trim the BSTR down to 1024 to stop this error message. I have tried several ways to do this including using the BSTRConnector:
Navision Attain Hash 1.0'.BSTRConverter
CREATE(bcon);
bcon.AppendNextStringPortion(ThisNode.text);
bcon.GetNextStringPortion(OutText, 1024);
CLEAR(bcon);
OutText is just a Text variable of length 1024.
The problem here is that the error still occurs at the line:
bcon.AppendNextStringPortion(ThisNode.text);
The AppendNextStringPortion parameter is a BSTR and ThisNode.text returns a BSTR. Is Navision trying to convert/cast ThisNode.text from the intrinsit BSTR to a Navision datatype (eg. Text), which is continuing to cause this error message?
Is there anyway to declare and Automation variable of type BSTR? I could not find the library it belongs to. Are there any BSTR operators to get a substring of a BSTR?
I am trying to get some data from the type 'Microsoft XML, v4.0'. IXMLDOMNode by calling the propery 'text' that returns a BSTR.
eg.
ThisNode.text;
However, there are times when this BSTR will be longer than the 1024 character limit of a Text variable, and I get the following error:
"the length of the text string exceeds the size of the string buffer"
I have been trying to trim the BSTR down to 1024 to stop this error message. I have tried several ways to do this including using the BSTRConnector:
Navision Attain Hash 1.0'.BSTRConverter
CREATE(bcon);
bcon.AppendNextStringPortion(ThisNode.text);
bcon.GetNextStringPortion(OutText, 1024);
CLEAR(bcon);
OutText is just a Text variable of length 1024.
The problem here is that the error still occurs at the line:
bcon.AppendNextStringPortion(ThisNode.text);
The AppendNextStringPortion parameter is a BSTR and ThisNode.text returns a BSTR. Is Navision trying to convert/cast ThisNode.text from the intrinsit BSTR to a Navision datatype (eg. Text), which is continuing to cause this error message?
Is there anyway to declare and Automation variable of type BSTR? I could not find the library it belongs to. Are there any BSTR operators to get a substring of a BSTR?
0
Comments
-
Hi weresjustin
try:CREATE(bcon); i := 0; x := 1; bcon.BSTR(ThisNode.nodeTypedValue); WHILE i < bcon.GetBSTRLength DO BEGIN bcon.GetNextStringPortion(OutText[x],1024); i += 1024; x +=1; END; CLEAR(bcon);
The ThisNode.Nodevalue are collected in OutText-array0 -
Thanks for that.
Justin0 -
Hi all,
i am using 'Microsoft Outlook 12.0 Object Library'.MailItem to get CC in SentItems but some mails CC string exceeds the string size (>1024).
i tried different ways to get the string size > 1024 but it show the same error(The length of the text string exceeds the size of the string buffer). Is there any solution to get the string size > 1024.
Thanks & Regrads,
naidu. ](*,)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions