Help with GET on table 50040 Contract Job Change Order

I’m trying to do a GET on table 50040 Contract Job Change Order.

For some reason it’s coming back empty.

Key is Job No.(Code 20), Change Order No. (Code 10).

All our Change Order No.'s are ‘0001’

Here is my code.

gsParentItemNo:=“No.”; (From table 167 “No.”)
gsLineNo:=‘0001’;

IF recContractchangeorder.GET(gsParentItemNo,gsLineNo) THEN BEGIN

gstempvalue:=“Change Order Amount”;

END;

I also tried using the SETRANGE but that bombs off because not all Contracts (table 167) have a Change Order.(table 50040)

recContractchangeorder.SETRANGE(“Job No.”,gsParentItemNo);
recContractchangeorder.FINDSET;

Thanks in advance,

Greg

Hi Greg,

Check the primary key to see if there is other fields in the key - you need to have all primary fields in the GET statement.

Also you are assigning “Change Order Amount” and not recContractchangeorder.“Change Order Amount” is that the problem?

That was it Dave.

I didn’t have the recContractchangeorder. before the “Change Order Amount”.

The GET was working all the time. Surprised it Compiled without it.

Thanks,

Greg

You should not be surprised by that. As long as the “Change Order Amount” (or any field) exist in the REC variable - the system will compile as it is not a violation of the syntax to omit the REC in front of the field name.

What the system cannot decide is if the thing you are doing really makes sense [:D]

I feel stupid as I wasted at least an hour trying different things… I’ll know better next time.

Thanks to all,

Greg

I promise - you will not !

This is (even after more then ten years of programming in NAV) my favorite. It juste happened yesterday to me as well. I was setting a filter to one variable and in the repeat / until loop I summed up the field from a completely different variable. [:S]