0

Button to Create a New Linked Record?

Hello, I have a link from "Notes" table within my default record. So if anyone adds a note, it creates a new record linked to that one. Within my default record where the "Notes" table is linked to, I want to create a button, that when clicked, it automatically creates a new note, and links it to the default record. What would this formula be?

21replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    Try this, SM:

    let myID := Id;

    let nn := create Note;

    nn.(Id := myID)

    Like
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    Oops! Sorry! Correction—

    nn.('default record'.Id := myID)

    I'm still learning the nuances of Ninox code, so this may need to be tweaked. 

    Like
    • S Moore
    • SMoore
    • 4 yrs ago
    • Reported - view

    That did not work. 

    Like
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    Try using this for the final line instead:

    nn.(‘default record’ := myID)

    (note, I’m using ‘default record’ as the name of your parent table.)

    Like
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    Try using this for the final line instead:

    nn.(‘default record’ := myID)

    (note, I’m using ‘default record’ as the name of your parent table.)

    Like
    • S Moore
    • SMoore
    • 4 yrs ago
    • Reported - view

    No luck still. Can you retype the code in its entirety. The the main table that I want to link the record to is named 'Repair' and the table I want to automatically link to and create a new record is 'Repair Notes' so what I want to do, instead of hitting the small + to create a new note that is automatically linked, I wish to just hit the button with the formula so it would like it automatically, and I can type in my new note.

     

    Thank you.

    Like
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    I went back and looked at some of my code and I see what I missed. For a button in table 'Repair' with a subtable linked to it named 'Repair Notes', this code goes in the button:

    let myID := number(Id);

    let nn := create Note;

    nn.('Repair' := myID)

    Like
    • Laura
    • Laura
    • 4 yrs ago
    • Reported - view

    From your description, you're going to also want popupRecord, which will take you to the new note. I'm currently trying to figure out how to use that. Once I get it, I'll drop you a line.

    Like
  • let myID:=Id;

    let NN:=create 'Repair Notes';

    NN.Repair:=myID;

    let myRN:=number(NN.Id));

    popupRecord(record('Repair Notes',myRN))

     

    Leo

    Like
    • S Moore
    • SMoore
    • 4 yrs ago
    • Reported - view

    Leo, 

    I was able to use the first 3 lines to create a new linked record. The last two lines are not working to open that record. 

    Like
  • do you use a WEB-APP?,

    try this:

    let myID := Id;
    let NN := (create 'Repair Notes');
    NN.(Repair := myID);
    popupRecord(record('Repair Notes',number(NN.Id)))

     

    Leo

    Like
    • S Moore
    • SMoore
    • 4 yrs ago
    • Reported - view

    I finally got it! Thank you!!!

    Like
    • Andrea
    • Andrea
    • 4 yrs ago
    • Reported - view

    Hi,

    through a linked table I select the items I have to invoice. When I select one the table closes and I have to re-open it again to select another one. Is it possible use a similar code for multiple selection?

    thx

    Like
  • that is not possible yet

     

    Leo

    Like
    • Andrea
    • Andrea
    • 4 yrs ago
    • Reported - view

    Hi Leo,

    is there an alternative way to link multiple records at once? I've hundreds of records to link and doing it individually is very exhausting :(. Thank you

    Like
  • Hi Andrea,

    you can filter the records and then run the update multiple records

    Leo

    Like
  • 자동 링크 응용사례

    A 테이블 이름: '4.수량산출내역서'

    B 테이블 이름: '5.실정보고'

    Reference form A테이블 to B테이블(1:N)

     

    A 테이블 버튼 공식

    A테이블 과 B테이블의 조건(검색어)이 일치하는 레코드를 자동으로 링크할수 있다 

    let myID := ID;
    let my := '검색어';
    let x := (select '5.실정보고' where '검색어' like my);
    let cx := x.IDD;
    for q in cx do
    let i := number(substr(q, index(q, "MB") + 2));
    let new := record('5.실정보고',number(i));
    let qq := new.('4.수량산출내역서' := myID);
    if x = null then 0 else qq end
    end

    Like
  • IDD 공식

    raw(id)

    ex) MB141

     

    테이블 마다 값이 문자를 포함한 숫자로 나타난다.

    우리는 숫자만을 원하기 때문에 

    let cx := x.IDD;
    for q in cx do
    let i := number(substr(q, index(q, "MB") + 2));               / 값 141

    .

    .

    .

    end

     

    레코드 수가 많을때 링크 속도를 올릴수 있는 방법은 무엇입니까?

    Like
    • Andrea
    • Andrea
    • 4 yrs ago
    • Reported - view

    Hi hanimax4001@gmail.com,

    is your code a solution to multiple selection?

    Thank you

    Like
  • I tried to make multiple selections.

    Select button (select child records)

    Connection button (in the invoice)

    Revert button (1 time only)

    Done button (dismiss fields of multiple selected child records)

    a Move the record of the invoice (child table) to b Invoice

     

    https://ninoxdb.de/en/forum/technical-help-5ab8fe445fe2b42b7dd39ee7/multi-link-5b409039b7638b1c06fb18c3

    Like
Like Follow
  • 4 yrs agoLast active
  • 21Replies
  • 9483Views