DBL_Setfilter in cfront

jksjks Member Posts: 277
Hi all,

I am using DBL_SetFilter to set filter to the 2end field of the table. my 2end filed is of type BigInteger. I have used it as follow

void *vp;
unsigned short d;
d=23400;
vp=&d;

DBL_SetFilter(hTable,2,"=%1",(double*)vp,NULL);

but no record is selected.

Please help.

Comments

  • jksjks Member Posts: 277
    Hi all,

    Back to the same problem. ](*,)

    Earlier when i faced the above problem, i did following:

    char minNo[12];
    char maxNo[12];

    /* minNo and maxNo contains number string*/

    DBL_SetFilter(hTable,2,(const unsigned char*)">=minNo&<=maxNo","","",NULL);

    again here second field is of type biginteger (in my navision table). At that time there was no exception handling logic in my program. So it worked fine.

    But now i am handling exception in my program. In that case above statement throws an exception saying

    you can not enter "minNo&<=maxNo" in biginteger. Cursor is in front of invalid character.

    Then i tried following

    DBL_SetFilter(hTable,2,(const unsigned char*)">=%1&<=%2",(long*)minNo,(long*)maxNo,NULL);

    DBL_SetFilter(hTable,2,(const unsigned char*)">=%1&<=%2",(char*)minNo,(char*)maxNo,NULL);

    // tried by directly assigning value of a variable of type long.
    long a,b;
    a=34355;
    b=54356;
    DBL_SetFilter(hTable,2,(const unsigned char*)">=%1&<=%2",&a,&b,NULL);


    but above statements also throw an exception :

    There is no dongle within the filter.
    and some garbage value comes instead of true value of minNo and maxNo.

    Please help. :(
  • jksjks Member Posts: 277
    please help. :(
  • dick11dick11 Member Posts: 60
    I use those fields too and it works (C# with CFront.dll)

    Please try the following syntax:

    [DllImport( cfrontdll, CallingConvention = CallingConvention.Cdecl, EntryPoint="DBL_SetFilter")]
    private static extern void DBL_SetFilterlong(int hTable, int FieldNo, string FilterStr, ref long Value1, ref long Value2, ref long Value3);

    And try that function with something like:

    DBL_SetFilterlong(MyhTable, MyFieldNo, MyFilterStr, ref MyValue1, ref MyValue2, ref MyValue3);

    Success
    Dick van der Sar

    www.dasautomatisering.nl
  • jksjks Member Posts: 277
    Hi dick11,

    Thanks for your reply.
    I am using c++ with cfrontsql.dll

    I tried using your code but it gives me following compile time error:

    'DllImport': attribute not found; it is neither a built-in nor a custom attribute that is accessible in the current namespace.

    I am new with DllImport. DBL_SetFilter is there in cfrontsql.dll as well. then why do we need to import it?

    Please help.
  • dick11dick11 Member Posts: 60
    So you do not have C#...

    That Import is a compiler command to tell him what the syntax is
    Please ignore it and try something like:

    int MyhTable = 123456, MyFieldNo = 2;
    string MyFilterStr = ">=%1&<=%2";
    long a=34355, b=54356, c = 0;
    DBL_SetFilterlong(MyhTable, MyFieldNo, MyFilterStr, ref a, ref b, ref c);

    I do not have a c++ compiler anymore so I give you a C# version, that should be easily converted (for example ref -> &)

    Success
    Dick van der Sar

    www.dasautomatisering.nl
  • jksjks Member Posts: 277
    Hi,

    I tried above code. In it instead of DBL_SetFilterlong i used DBL_SetFilter.
    But still getting same run time exception.

    'There is no record withing the filter'
    I am also displaying filter using DBL_GetFilter and it displays like

    >=1049457090890434&<=42534555 (i.e a and b get replaced by some garbage value)

    Please help.
Sign In or Register to comment.