0

set values in a child

Hi there I am fighting a little with setting a marker in a child based on a value in the parent.

The case is that I have for example a project nr which is the parent and the children are persons which should perform different jobs in this project. On a daily basis the persons update that they have done the job by chosing to set a choice field to 1 (Task done) and that is how it should be, and when this choice has been made I lock this particularly record for further update, however the other persons in the same projects are still open for update until they make the same choice. So far so good - so here comes the problem :

Let us say that for example one of the persons has not made the choice even if he is finished with the task, and at the same time the administrator closed the project on the parent site (the project nr), then I would like to secure that all the children in this project had the marker "task done" set.

 

anyone who knows how to do it ??

rgds

Leo

9 replies

null
    • John_Halls
    • 8 days ago
    • Reported - view

    If the child table is called Child then in the Trigger after update of the open / closed field put this code

    if 'open / closed' = 2 then
       for a in Child do
          a.Choice := 1
       end
    end
    
      • Alain_Fontaine
      • 8 days ago
      • Reported - view

       Maybe hard to believe, but you can simply do:

      if 'open / closed' = 2 then
         Child.Choice := 1
      end
      
      • John_Halls
      • 7 days ago
      • Reported - view

       I do believe.

      • Leo_Woer
      • 7 days ago
      • Reported - view

      Hi Alain, thanks for the input, however, I am a little in doubt about where you would place this if settings. For further explanation - the scenario is the following :

      In the parent ("Project Activities") I produce and invoice, and in this script I want to close all related children for further input. Next there are in fact two Child tables 1( the Staff) which work now and 2(materials) which does not work, and the next problem is that if I do another for in do the sytem cannot find this table - any idea why ??

      rgds

      Leo

      • Leo_Woer
      • 7 days ago
      • Reported - view

      Hi John - I encountered another problem, I hope you can answer this - see below what I wrote to Alain :

      Hi Alain, thanks for the input, however, I am a little in doubt about where you would place this if settings. For further explanation - the scenario is the following :

      In the parent ("Project Activities") I produce and invoice, and in this script I want to close all related children for further input. Next there are in fact two Child tables 1( the Staff) which work now and 2(materials) which does not work, and the next problem is that if I do another for in do the sytem cannot find this table - any idea why ??

      rgds

      Leo

      • Leo_Woer
      • 7 days ago
      • Reported - view

      Hi again - found the problem - for some reason Ninox still sees the table as the former English name I gave it, and even if I have renamed the table it still finds it under the old name - strange. I think I have to rename again.

       

      So don't waste your time on this - again thank you for the help.

       

      regards

      Leo

      • John_Halls
      • 7 days ago
      • Reported - view

       Works with select commands too. I didn't know this. How did it pass me by?

      • Alain_Fontaine
      • 6 days ago
      • Reported - view

       It works with any array of records. Deferencing a 1:N reference field or executing a select instruction are the two most evident ways to produce an array of records. Of course, there are many others…

    • Leo_Woer
    • 8 days ago
    • Reported - view

    That was super - work as intended - thank you so much

    Have a nice Sunday

    rgds

    Leo

Content aside

  • 6 days agoLast active
  • 9Replies
  • 66Views
  • 3 Following