0

Is there any way to consolidate multiple select()

#{ ---- Variables Encabezado del Proyecto ---- }#;
let projectName := first((select 'ENG WORKORDERS').'WORKORDER Name');
let totalBudget := sum((select 'WR-TASK').Budget);
let totalHours := sum((select 'WR-TASK').Hours);
#{ ---- Variables del Level 1 Areas son 2 Areas ---- }#;
let area_1_id := first(select 'WR-TASK' where Level_1 = 1).Level_1;
let area_1_budget := sum((select 'WR-TASK' where Level_1 = 1).Budget);
let area_2_id := first(select 'WR-TASK' where Level_1 = 2).Level_1;
let area_2_budget := sum((select 'WR-TASK' where Level_1 = 2).Budget);
#{ ---- Variables del Level 2 SubAreas son 3 PEP' ---- }#;
let subArea_1_id := first(select 'WR-TASK' where Level_2 = 1).Level_2;
let subArea_1_budget := sum((select 'WR-TASK' where Level_2 = 1).Budget);
let subArea_2_id := first(select 'WR-TASK' where Level_2 = 2).Level_2;
let subArea_2_budget := sum((select 'WR-TASK' where Level_2 = 2).Budget);
let subArea_3_id := first(select 'WR-TASK' where Level_2 = 3).Level_2;
let subArea_3_budget := sum((select 'WR-TASK' where Level_2 = 3).Budget);

Is there any way to consolidate multiple select()

6 Antworten

null
    • Fred
    • vor 4 Tagen
    • Gemeldet - anzeigen

    each result is an array, so you can use the array() command to combine arrays. But if you want to combine recId then they have to be from the same table.

    Since you are using only the 'WR-TASK' DB, instead of doing a select in each line, make a new variable on line 1 that does the select then you can filter the variable as needed. Something like:

    let wrtackRecs := (select 'WR-TASK');
    let totalBudget := sum(wrtackRecs.Budget);
    let totalHours := sum(wrtackRecs.Hours);
    and so on....
      • Rafael_Sanchis
      • vor 4 Tagen
      • Gemeldet - anzeigen

       Thanks fred 👍, I don't know why I can't acces the english forum 😞 can't login

      • Fred
      • vor 4 Tagen
      • Gemeldet - anzeigen

       try deleting the cookies and data for ninox in your browser then try again.

      • Rafael_Sanchis
      • vor 3 Tagen
      • Gemeldet - anzeigen

       

      Hi Fred, Need to add some changes, and work

      let wrtackRecs := (select 'WR-TASK');
      let area_1_id := first(wrtackRecs[Level_1 = 1]).Level_1;
      let area_1_budget := sum(wrtackRecs[Level_1 = 1].Budget);
      let area_2_id := first(wrtackRecs[Level_1 = 2]).Level_1;
      let area_2_budget := sum(wrtackRecs[Level_1 = 2].Budget);
      
      • Rafael_Sanchis
      • vor 3 Tagen
      • Gemeldet - anzeigen

       

      This is taking on a very interesting aspect and is gradually being optimized.

      • Fred
      • vor 3 Tagen
      • Gemeldet - anzeigen

       That looks great!

Content aside

  • vor 3 TagenZuletzt aktiv
  • 6Antworten
  • 39Ansichten
  • 2 Folge bereits