0

Button to apply filter to sub-table

Hi everyone,

I've got a main table 'CONTRAT' that corresponds to our technical contract where i can find the start and end date, name of the client... 

And a sub-table 'INTERVENTIONS' that corresponds to each technical support done where i can find the date of the support, the duration and a description of what have bee done.

By clicking a button from the main table i'd like to display all the records of the sub-table included in a specific date period. According to what i've read, i think i've got to use a select / where script but i'm not familiar at all with this.

Any clues ?

thanks 

5 replies

null
    • Fred
    • 5 mths ago
    • Reported - view

    You can do a select. You call INTERVENTIONS a subtable of CONTRAT I will assume they are linked in a N:1 relationship, many interventions to 1 contrat. If that is true then you can use the relationship to speed up your filter.

    I'm not sure what you want to do exactly. Are you setting up a Dashboard/Page with a start/end data field? Or are you in your CONTRAT table that has date fields?

    Either way you can do something like this in a view element:

    INTERVENTIONS[SupportDate >= startdate and SupportDate <= enddate]
    
      • IDAO_SARL
      • 5 mths ago
      • Reported - view

       Thanks for the answer.

      To be more accurate here is a screenshot of the table view.

      Indeed they are linked in a N:1 relationship, many interventions to 1 contrat.

      I've many buttons for each quarter of a year and would like display only the technical interventions for the 1st, 2nd, 3th ou 4th quater by clicking them.

      Thanks

    • Fred
    • 5 mths ago
    • Reported - view
     said:
    I've many buttons for each quarter of a year and would like display only the technical interventions for the 1st, 2nd, 3th ou 4th quater by clicking them.

     Do you have a field that uses the quarter() command? Or do you have another way of figuring out quarters?

    You can not modify the reference field table indirectly, but you can with a view element so you could move the reference field table to another tab to hide it then create a view element.

    I think you will need a number field to store the quarter you are looking for. In the Contct table, can create a number field and call it QtrNum. You will need a field in Interventions. We can call this Quarter. You will use the quarter() command to tell Ninox to figure out the quarter.

    Your buttons can have the code:

    QtrNum := 1
    

    You can change the number for each button. The total button can be:

    QtrNum := null
    

    Then you can create a view element with:

    let xQtr := QtrNum
    if xQtr = null then
    Interventions
    else
    Interventions[Quarter = xQtr]
    end
    
    • IDAO_SARL
    • 5 mths ago
    • Reported - view
     said:
     Do you have a field that uses the quarter() command? Or do you have another way of figuring out quarters?

     I've created two date fields for the start and end date of the quarter.

    Each button returns the corrects dates, for example : 1st Quarter returns 1st january et 31th march.

    But i didn't know the quarter() command. And i'll try this and keep you informed.

    Thanks a lot.

    • IDAO_SARL
    • 5 mths ago
    • Reported - view

     Hell, It works well. Thanks for helping me.

Content aside

  • Status Answered
  • 5 mths agoLast active
  • 5Replies
  • 94Views
  • 2 Following