Hi, i just encountered a strange problem. Here the description of what i am doing: 1) i get the first record of this table with FIND(’-’) 2) then i modify a field and call DBL_ModifyRec 3) i make an output from hRec to check if the field was really changed (<- so far it works) 4) i close table, company, database And after checking the table in Navision there was no change. As far as i checked the c++ program everything should work and all needed functions described in c/front help are used. Any ideas or did anyone have the same problem?? Thx for any help!
Hmm … can anyone tell me what is the meaning of the return value of ModifyRec?? 0 = true 1 = false or the opposite? Sry i am relatively new in C++ and i know that in one specific case 1 is false. i retrieve the return value this way: bool CNFCompany_Information::Modify() { int tf = 0; tf = DBL_ModifyRec(hTable,hRec); if (tf) { return true; } else { return false; } }
quote:
Originally posted by blum
Hmm … can anyone tell me what is the meaning of the return value of ModifyRec?? 0 = true 1 = false
In C/C++: FALSE = 0 TRUE = 1 or anything different than 0
Did you perhaps forget to call DBL_BWT and DBL_EWT?
Then somehow the modify never works and always returns FALSE. Yes, i used DBL_BWT and DBL_EWT.
Check pointers. All trouble are in pointers for beginers !!! You have problems with HRec or HTable. I can’t say where without your code.
Thanks for your help so far, but i have “found” the error. As i am using a program of someone else who already programmed connect and opening of tables the error must be somewhere there as this program was originally only made for read access. So this will be a difficult task for me to find this error. Because of this i have reprogrammed a write access as described in c/front help pdf. But also there seems to be an error, currently i am writing this way (like descriped in C/Front documentation): DBL_AssignField(hTable,hRec,52006,DBL_FieldType(hTable,52006),“XXX”,strlen(“XXX”)); DBL_ModifyRec(hTable, hRec); Table 52006 is a code field with length of 3. If i run the code above value XX is written into this field, if i use the following code it works correctly: DBL_AssignField(hTable,hRec,52006,DBL_FieldType(hTable,52006)," XXX",strlen(“XXX”) + 1); [or strlen(" XXX")] DBL_ModifyRec(hTable, hRec); so my question: why is the first letter cutted from string?!??!
52006 is code data type field. Check documentation, code format is: [digit lenght/FF - for text][Char]…[Char][0]
Thanks! Now i got it (nearly)!
Hi again! So i have made a kluge by creating a new character and moving all chars one right. This means “ABC” is " ABC" when using function AssignField and in Navision i have again “ABC”. Sure i can work this way but it looks for me like a not very proper solution. Can anyone explain (a little bit more detailed) why code fields work this way?? I read the help and there i found this: #define DBL_Type_STR (45 * 0x100) /* Max Field Len + 1 byte */ i think this is related with my code field problem. But it doesn’t explain this problem for me! [V]
#define DBL_Type_STR (45 * 0x100) is deffinition of constant used in func. like AssignField. So in type param you can use DBL_Type_STR or (45 * 0x100), there nothing about structure of data type. Check Alpha data type. If Str has non numerics chars: [/0xFF]ABCDEBLABLA [/0xFF]122258A If str contains only numeric chars then first byte used for str lenght: [1]9 [3]254 [8]12345678 For Alpha and String data types conversion use DBL_Str_2_Alpha or DBL_Alpha_2_Str.
Thanks that worked! Great help!!! [:D]
fyi the extra byte in a code type var compared to text, is to indicate if the value is left or right justified when displayed.