Copy dimensions from

jme
jme Member Posts: 3
I have a question about advanced job management
I want to add the functionality to copy the dimensions which are set on the Job qoute to a Job.

I added this code but it not working
note that iRecJob = Job Quote and lRecJob is the Job.



IF lRecJob.GET(iRecJob."No.") THEN BEGIN
lRecJob.VALIDATE("Global Dimension 1 Code",iRecJob."Global Dimension 1 Code");
lRecJob.VALIDATE("Global Dimension 2 Code",iRecJob."Global Dimension 2 Code");
lRecJob.MODIFY();
END;

Can anyone help please?

thanks in advance

Joran van de Mast

Comments

  • matttrax
    matttrax Member Posts: 2,309
    Could have to do with where you placed your code. It's very easy for something to come along and change the values, especially dimensions, after your code has executed.

    Go through the debugger, as painful as it is, and see if that is the case.
  • jme
    jme Member Posts: 3
    I have solved the problem for you
    see the code here below

    WITH lRecDefaultDim DO BEGIN
    SETRANGE("Table ID", DATABASE::Job);
    SETRANGE("No.", iJobNoFrom);
    IF FINDSET THEN BEGIN
    REPEAT
    lRecDefaultDim2 := lRecDefaultDim;
    lRecDefaultDim2."No." := iJobNoTo;
    lRecDefaultDim2.INSERT();
    UNTIL NEXT = 0;
    END;
    END;