0

Open child form from table (fill in data) abd return to main form.

I have a main table (quotes) and child tables (quotelines).

up to now, I have used selected data entry fields on the main table form and then used a button script to copy that data into a child record. (has always worked great and I will continue to use).

However, I have another need whereby I want to create and open the child record first (from a button again) fill in some data and then return back to main form. Don't want to use data entry field method for this as there will be lots of fields and this will clutter up the main form (and complicate the display if options)

Should work as if I pressed the "create record" function at foot of child table ( won't be using this as will a table view instead which will not show this option and then return back to main form showing the child table below.

A quick Test script works to create the child table but then on closure only shows the the child table for all ie not returning back to the main table record showing the child table view .

I have fiddled about with various option ie setting a type of on close record in form

let xCurrRec := Id; (from Quotes)
let xQLnum := QLnum;
let i := (create QuoteLines);
openRecord(i);
i.(Quotes := xCurrRec);
i.(QLnum := xQLnum);
QLnum := max(QuoteLines.QLnum) + 2 (my sub line counter which allowesa me to adjust to sort lines)

trying to pass xCurrRec did not seem to work

any suggetions ?

7 replies

null
    • Fred
    • 2 days ago
    • Reported - view

    Try putting the openRecord() line at the end. You need to allow Ninox to do the copying before you open the record. It is kinda like opening the oven before the soufflé is finished.

      • red_kite
      • 2 days ago
      • Reported - view

       😉

    • Mel_Charles
    • 2 days ago
    • Reported - view

    Fred

    That done't work i can open the child record okay but it after data entry that i want to come back to the main form ie as per this image

    Done a test DB

    Open Quotes and use test copy button

      • Fred
      • 2 days ago
      • Reported - view

       Sorry, I didn't mean to imply that moving openRecord() will change the how the record closes. The issue here is you have created a new record and thus Ninox has moved you to the appropriate table that the record belongs to. 

      Consider making a new button called Return to Quote and put this in the code:

      openRecord(Quotes)
    • Mel_Charles
    • yesterday
    • Reported - view

    Ah ha

    I can do it by this! on said close button!

    let xCopy := fxQteRef;
    let i := first(select Quotes where QteNum = xCopy);
    closeAllRecords();
    openRecord(i)

    Thank you ( as usual) for the expert guidance 😊

      • Fred
      • yesterday
      • Reported - view

        You can also just use the Quotes reference field. no need for a select.

    • Mel_Charles
    • yesterday
    • Reported - view

    👍

Content aside

  • Status Answered
  • yesterdayLast active
  • 7Replies
  • 19Views
  • 3 Following