Cfront.DLL with Navision 3.70 - DBL_Setfilter

Hi everybody, I’m currently developing a Delphi application that connects to Navision 2.60 and 3.70, with Navision 2.60 and its own cfront.dll there’s no problem, but when I try to work with Navision 3.70 and its own DLL almost everything works except the DBL_SetFilter function. Can anyone help me?? Thanks.

try using the ocx instead of the dll so some of the c & delphi interaction problems won’t be there … maybe you can also post some sample code ?

At the beginning we just have one version of Navision (2.60) and we used the ocx, but now we need to connect from the same client to different versions of Navision (2.6 and 3.70) and the problem with the ocx is that just one ocx can be registered at the same time, and 3.70 OCX can’t access to Navision 260 and 2.60 OCX can’t access to Navision 3.70. Code sample


// FilterStr intial value = ‘test…test’; procedure AplyFilter(FilterStr : String) var sAux: string; p: array[0…8] of Pointer; begin // initilization of the first position to nil p[0] := nil; // Convert the Filterstr from Ansi to Oem to avoid problems with characters DBL_Ansi2OemBuff(PDBL_U8(FilterStr), PDBL_U8(sAux), length(FilterStr)); // Filter application, here I get an error (Access violation) // htable and FieldNo are correct DBL_SetFilter(hTable, FieldNo, PDBL_U8(sAux),p); end;

i am not so close with the different variants of strings and chars and so on but some time ago their exists an adapter unit for delphi and the cfront.dll. SetFilter() was filled with a pchar and not a pure delphi-string: TDBL_SetFilter = procedure(hTable: DBL_HTABLE; FieldNo: DBL_S32; FilterStr: PChar; ValuePtr: array of pointer); you can find it at … maybe this helps ? b.t.w. does it work when you put your string in the code ? like this: cFront.SetFilter(myTable, myRec, ‘=0’); ?

Hi Alexandre, first of all thank you for your help. The SetFilter function declaration that I have is the same that you tell me TDBL_SetFilter = procedure(hTable: DBL_HTABLE; FieldNo: DBL_S32; FilterStr: PChar; ValuePtr: array of pointer); if you see the sample code I posted I’m doing a casting of the string to PDBL_U8 that represents a PChar, besides I have another declaration of this function with the same parameters but declared to work with Nav 2.60 and it works fine. About try to put the string directly in the code, I think the example you wrote is an ocx example, and it works but I can’t use it. Thanks.

PROBLEM SOLVED!!! AAAAAGGHHHH!!!, it was an very simple an stupid error, the DBL_SetFilter function was declared as external but I forgot to put the “cdel” attributte at the end the declaration. Thanks to all.

Great! Maybe now this topic can be moved to the Navision (Attain/Financials) - Developer Forum where it should have been posted in the first place…

Thanks Nelson, But I’ve actually moved it from the MS CRM Developer Forum to Navsion Integration Forum…