0

Button to duplicate entry in a second table?

Hello,

Not sure if this is possible, but I would like to do the following...

I have a table called 'Parts' and another table called 'Purchase Order'.

What I would like is to have a button on the 'Parts' entry tab that when clicked also enters the entry as a line in the 'Purchase Order' table, indicating to purchasing that it is not a stock item and needs ordering.

Is there a way to do this at all?

Many thanks in advance! Anna

4 replies

null
    • Danjamesmedia
    • 4 yrs ago
    • Reported - view

    Hi Anna,

    Yes this is possible. You'll need to write a formula using the "Create Record" function documented here: https://ninoxdb.de/en/manual/calculations/reference-of-functions-and-language

    The exact formula will depend on your setup, where you want to pull values from, and how you may want to link it, etc.

    • Anna_Wenlock
    • 4 yrs ago
    • Reported - view

    Thanks Dan, I will have a go but if I struggle (or break everything) I might be back for help!

    • Anna_Wenlock
    • 4 yrs ago
    • Reported - view

    No good, struggling. My code knowledge is currently minimal.

    Can anyone help me with the code I need please?

    The function I am after is as follows...

    When a button (named 'Submit Purchase Order') is clicked, I want the newly created entry in 'Parts' to be duplicated to another table called 'Purchase Order'

    Is this possible? If so, can someone please suggest what the code might be? I think it may involve duplicate(this) but not sure how to apply it.

    Thanks!

    • Nick
    • 4 yrs ago
    • Reported - view

    Hi Anna,

    you need something like this (for button 'Submit Purchase Order' in table 'Parts'):

    ---

    let c := PartCode;
    let n:= PartName;

    let po := (create 'Purchase Order');
    po.(PartCode:= c);

    po.(PartName:= n);

    ---

    This stores the part's info to a variable, then creates a record to second table and enter the info.

    Change the field and table names and, of course, you can expand this code to include more fields.

    I hope it's clear...

Content aside

  • 4 yrs agoLast active
  • 4Replies
  • 1434Views