The expression Boolean cannot be type-converted...

Hello, this code works (report DataItem OnPreDataItem trigger) FALEntry.GET((FALEntry.“FA No.” = “No.”) AND ( FALEntry.“FA Posting Type” = 0)); EntryDate := FALEntry.“Document Date”; EntryNo := FALEntry.“G/L Entry No.”; but this doesn’t: FADBook.GET((FADBook.“FA No.” = “No.”) AND ( FADBook.“Depreciation Book Code” = ‘COMPANY’)); PrCost := FADBook.“Depreciable Basis”; …when running report it says “The expression Boolean cannot be type-converted to a Code value”. I see no difference between these 2 codes. What’s wrong?

(FADBook.“FA No.” = “No.”)AND (FADBook.“Depreciation Book Code” ‘COMPANY’) Returns a Bool while FADBook.GET expects a code type. I Think FALEntry.GET expects a number import which a bool type can be type converted. Paul Baxter

To do a GET properly, you need to supply all fields for the Primary Key. What you are overlooking is that in FALEntry the field FA Posting Type is an Option field, where you can use the numeric value to select an option. IN FADBook the Depreciation Book Code is a Code field, on which you are now trying to do a boolean comparison on. Change your GET into SETRANGE on both fields, then do a FIND. John

Well, thank you, but it doesn’t work. What I am trying to do is to print the field “Depreciable Basis” from FA Depreciation Book table on the Fixed Asset (5600) section of report. (“Fixed Asset”.“No.” = “FA Depreciation Book”.“FA No.”). Any ideas?

FADBook.RESET; FADBook.SETRANGE(“FA No.” , “No.”); FADBook.SETRANGE(“Depreciation Book Code” , ‘COMPANY’); IF FADBook.FIND(’-’) THEN PrCost := FADBook.“Depreciable Basis” ELSE PrCost := 0; OR better in this case IF FADBook.GET(“No.”,Depreciation Book Code") THEN PrCost := FADBook.“Depreciable Basis” ELSE PrCost := 0; You ether GET a single record and supply all the fields in the primary key or you filter (SETRANGE) and return a subset of records. You can use FIND and NEXT to navigate through these records. You should always, always, always take account of the possiblity of failure to find any records and zero and varible or else it will hold the value from the last itteration. Paul Baxter