0

Select a field in a record in a linked table on Trigger new data set

Hi!

I have 2 linked tables: TAB-A and TAB-B

In TAB-B I have a number field named "nr"

In TAB-A I have a number field called "tax"

 

In TAB-A I have this formula in Trigger in new data set:

  1. let dtsel := (select TAB-B)[ID = 1];
  2. let aftax := dtsel.nr;
  3. 'tax' := aftax;

This formula gives me the following error:
the expression provides multiple values: aftax online...

 

Instead this other formula works:

  1. let dtsel := first(select TAB-B);
  2. 'tax' := aftax.nr

But I would like to make the first formula work because on other occasions I need to select different IDs.

 

Can you help me?

2 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    When you use a select() command, Ninox always assumes multiple records will be returned even if only 1 record is found. So Ninox always asks you to tell it what to do.

    You could do:

    let dtsel := first((select TAB-B)[Id = 1])
    

    or if you know the record Id, then may I recommend the record() command.

    let dtsel := record('TAB-B',1);
    tax := dtsel.nr
    
    • Web_Namer
    • 1 yr ago
    • Reported - view

    Thank you for the comprehensive answer Fred

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 2Replies
  • 114Views
  • 2 Following