BSTRConverter doesn't seem to work and I've ran out of ideas
Miklos_Hollender
Member Posts: 1,629
Hello,
I have a Third Party OCX Component (used for a kind of reporting) I should call like for example:
Variable name, value converted to text, type. Easy.
Now imagine passing instead of FORMAT(Cust.Balance), say, 5000 characters of (non-XML) text I store in a BLOB field...
I've tried the following:
I get a string buffer error at the last line.
Isn't it exactly what this converter is for? Any ideas?
I have a Third Party OCX Component (used for a kind of reporting) I should call like for example:
TPComponent.DefineVariableExt('Customer.Balance', FORMAT(Cust.Balance), TPConst('NUMERIC_LOCALIZED'));
Variable name, value converted to text, type. Easy.
Now imagine passing instead of FORMAT(Cust.Balance), say, 5000 characters of (non-XML) text I store in a BLOB field...
I've tried the following:
CLEAR(BigTextVar);
CLEAR(InS);
Cust.CALCFIELDS(Cust."BLOBField");
Cust."BLOBfield".CREATEINSTREAM(InS);
BigTextVar.READ(InS);
//it's just an example, I'm to tired at 19:15 to write out the loop for it's sake, just imagine the loop here :)))
bcon.ResetBSTR;
CLEAR(t1000);
BT.GETSUBTEXT(t1000,1,1000);
bcon.AppendNextStringPortion(t1000);
CLEAR(t1000);
BT.GETSUBTEXT(t1000,1000,1000);
bcon.AppendNextStringPortion(t1000);
CLEAR(t1000);
BT.GETSUBTEXT(t1000,2000,1000);
bcon.AppendNextStringPortion(t1000);
TPComponent.DefineVariableExt('LongBigYadaYada',bcon.BSTR, TPConst('TP_TEXT'));
I get a string buffer error at the last line.
Isn't it exactly what this converter is for? Any ideas?
0
Comments
-
COM interfaces are still limited at 1024.
I know there are some post that mention this automation as a solution, but it's false.0 -
COM interfaces are limited to 1024 from the classic client yes.
If you use RTC or Web Services you can use BigText directly as a parameter to a method expecting a string - and you can get things from a method returning a string of any length adding that to a BigText in ADDTEXT.
http://blogs.msdn.com/freddyk/archive/2008/11/04/transferring-data-to-from-com-automation-objects-and-webservices.aspxFreddy Kristiansen
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.0 -
Thanks but the solution I'm building needs to support both clients, for a few years at least.
The basic problem is that this OCX only accepts BSTR parameters which NAV understands as text. Freddy, is there any special reason why NAV refuses to give a BigText variable to an OCX that expects a BSTR - what is a BigText internally, if not a BSTR?
And this OCX cannot read a stream, nor a file, nor has it a method that would add to the variable instead of overwriting it...
I suppose it would be the same trying to force it into XMLDOM...
Would it be possible to write a .NET OCX object that would take the instance of the non-.NET OCX object I'm struggling with plus a BigText variable or InStream or whatever and would feed the later into a method of the former? If yes could someone give a rough sketch of pseudocode how?
Any other ideas? Thx.0 -
you have to write a wrapper dll using vb or any .net language and use that dll in in nav.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
