0

popupRecord for child record via button

Dear Support-Community

I'm new at using Ninox and I try to figure out some things.

I want tho give the user the possibility to go directly to a child record with a button.

I got only one parent table with a related child table in my database structure.

On parent table form the user (who should'nt have access to the related child table via an embedded view or an 1:N relation field) should chose in a DCF the related record from the child table which she/he wants to edit and then hit a button "edit" to jump right to this record. (Editing this chosen one only)

I thought it would be the script for the "on click" line at the button like this:

1  let RecID := number('DCF');
2  let myRec := item('child table', RecID);
3  popupRecord(myRec, "tabname in child table") 

but nothing happens at all. 

I'm using the web app.

Did I missed something? 

Thanks a lot for a little hint.
Carsten

9 replies

null
    • Cloud DevOps Fullstack Engineer
    • Martin_Mueller
    • 1 yr ago
    • Reported - view

    What do you mean by going directly to a child record? AFAIK that is out of the box possible as a popover opens. Like here when I click on a Project. I do see the child in there. 

      • public transportation operations
      • Carsten_Steinmann
      • 1 yr ago
      • Reported - view

      Martin Mueller 

      Thanks for your reply and Screenshot.

      If I see it correctly, you just mention to use the embedded view or the 1:N relation field to show up the child records. With these I know I can display the child records directly in the form of the parent table and by clicking one of these I can edit it directly. So fare so good.

      What I meant is having a DCF as combobox and a button which just made the same as if I click in an embedded view or 1:N relation field to select a specific child record. 

      Because of some given specifications I don't want to show the editor user all related child records to the parent record - only the chosen one in the DCF and she/he should only be able to edit exactly this chosen one. (I know, it doesn't make quite sense, because she/he can see them all in the combobox from the DCF, and so the other way with the embedded view or 1:N relation field would be smoother, but ...) 

      So I thought there could be another way with a button, too. But anyway I might be wrong.

    • Mel_Charles
    • 1 yr ago
    • Reported - view

    Carsten

    I think you are referring to this (or similar)

    in my example

    I have the master table (JobDocket)

    I then have child tables for Quotes (and even other jobdockets but lets ignore this)

    as you can see on the screenshot there is a quote field with a number in it and a > button with the script in it.

    click the button and it opens that record directly.

    so click button and open record 7121 in quotes

    script in the button is

    let xCopy := 'Quote Ref';
    let i := first(select Quotes where QteNum = xCopy);
    popupRecord(i)

    This is only one solution that suits me as you have got the get thr ref of the child record.

    but you should be able to bend this do the same from a Drop down etc

    • Mel_Charles
    • 1 yr ago
    • Reported - view

    you will also see a at the top off the first form a tick box called show quotes. I have this set to show all related quote that meet a criteria - ie show quote but only those that are not marked as hidden and do not show cost margin fields etc

    so there are several way you could achieve what you wante

      • public transportation operations
      • Carsten_Steinmann
      • 1 yr ago
      • Reported - view

      Mel Charles Hey Mel. Thanks for your examble and the explanations. I will try this.

    • Fred
    • 1 yr ago
    • Reported - view

    That is weird. It works for me. I am on the MacOS app, but that shouldn't matter.

    let selDC := number(dMCTable2);
    let iDC := item(Table22, selDC);
    popupRecord(iDC, "Tab")
    

    Have you tried without the tabname and just popup the record?

      • public transportation operations
      • Carsten_Steinmann
      • 1 yr ago
      • Reported - view

      Fred Hey Fred. Thannks, I will try this, too.

    • public transportation operations
    • Carsten_Steinmann
    • 1 yr ago
    • Reported - view

    Thanks to all. Now it works.

      • Fred
      • 1 yr ago
      • Reported - view

      Carsten Steinmann good to hear. To help others can you post the final code that worked?

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 9Replies
  • 144Views
  • 4 Following