Get Purchase Receipt Line

JosetxoJosetxo Member Posts: 92
Hello,

first of all, sorry for the question... it may be too basic for an experienced programmer, but unfortunately, I am not one of them (yet).

My problem is this: in the company I work for, we perform quality control on the products we buy.
For this, I have set a table (Quality Control) with these fields:

- Document No (key) - it has a relationship with Document No. in table 121 (Purch. Rec. Line)
- Line No (key) - it has a relationship with Line No. in table 121 (Purch. Rec. Line)
- Product No.
- Quality Control Date
- Quality control fields (pass / fail, failure type...)

What I would like to do is this: from the Form of this Table, perform a lookup on table 121 and "bring" both the Document No. and Line No. to my Quality Control table, plus the product code (I think this part is not a problem), just by selecting one record.

How can this be achieved? Any help will be greatly appreciated.

Many thanks in advance,
Josetxo

Answers

  • SavatageSavatage Member Posts: 7,142
    Have you set any table relations on the properties of the fields you need to fill?
  • matttraxmatttrax Member Posts: 2,309
    Josetxo wrote:
    first of all, sorry for the question

    Don't apologize. You have to start learning somewhere and that's what places like this are for.

    I assume you want to do something like click a button called GetReceipt, select a receipt, and pull in all the lines. Is that right?

    To run a form and select an entry from it look at the LOOKUPMODE property and RUNMODAL function. When you do a runmodal and the form is in lookup mode it will return the record you have selected. You would probably select a purchase receipt header.

    From there you would set the appropriate filters on your lines using SETRANGE and/or SETFILTER and loop through them using REPEAT..UNTIL. In the loop you'll insert records into your QA table.

    Hope that points you in the right direction.
  • JosetxoJosetxo Member Posts: 92
    Hello Savatage,

    yes, I have set those relations:

    - Document No. in my table -> Document No. in table 121
    - Line No. in my table -> Line No. in table 121

    Thanks,
    Josetxo
  • JosetxoJosetxo Member Posts: 92
    Hello Matttrax,

    thank you, I'll have a look at those properties.

    Josetxo
  • JosetxoJosetxo Member Posts: 92
    Hello,

    done! I added a command button in my form that opens the Purchase Receipt Line (528) form in lookup mode. Then, I retrieve the selected record in the form and assign those values to fields in my new table:

    frm528.LOOKUPMODE := TRUE;

    IF frm528.RUNMODAL = ACTION::LookupOK THEN BEGIN

    frm528.GETRECORD(Rec_PurchReceiptLine);
    Rec.DocNo := Rec_PurchReceiptLine."Document No.";
    Rec.LineNo := Rec_PurchReceiptLine."Line No.";
    Rec.INSERT;

    END;

    CLEAR(frm528);

    Regards,
    Josetxo
  • matttraxmatttrax Member Posts: 2,309
Sign In or Register to comment.