0

Untertabelle mit Arbeitstagen füllen

Hallo, 

ich möchte eine Untertabelle mit den Tagen eines bestimmten Zeitraums füllen. Dazu verwende ich einen Button mit dem folgendem Code: 

let myID := this;
let beginn := Beginn;
let ende := Ende;
let tage := days(beginn, ende);
for i in range(0, tage + 1) do
    let neuEintrag := (create 'Einträge');
    neuEintrag.(Planung := myID);
    neuEintrag.(Datum := text(date(year(beginn), month(beginn), day(beginn) + i)))
end

Funktioniert wunderbar, allerdings möchte ich dass nur Arbeitstage aufgelistet werden. Hat jemand einen Tipp für mich wie ich dass am besten anstellen könnte. Irgendwie stehe ich auf dem Schlauch.

Danke im Voraus

Andreas

7 Antworten

null
    • Ninox-Professional
    • planoxpro
    • vor 4 Monaten
    • Gemeldet - anzeigen

    Hallo, versuch's mal so (berücksichtigt nur die Wochentage Mo. bis Fr.):

    let myID := this;
    let myDay := Beginn;
    let lastDay := Ende;
    while myDay <= lastDay do
        if weekday(myDay) < 5 then
            let neuEintrag := (create 'Einträge');
            neuEintrag.(Planung := myID);
            neuEintrag.(Datum := myDay)
        end;
        myDay := myDay + 1
    end
    
    
      • Rafael_Sanchis
      • vor 4 Monaten
      • Gemeldet - anzeigen

      planox. Por  Hi Planox

      I add a table Holidays with a Holidays ate field how can add holidays in this script.

      • Ninox-Professional
      • planoxpro
      • vor 4 Monaten
      • Gemeldet - anzeigen

       Yes, you could of course also integrate a holiday check. But let's solve the existing problem first. 😉

      • Master70
      • vor 4 Monaten
      • Gemeldet - anzeigen

      Danke  Problem gelöst 😊

      • Rafael_Sanchis
      • vor 4 Monaten
      • Gemeldet - anzeigen

       

      For what I needed it is ok👍 if you think it can be improved I hear options. Thanks.

      if Plan5_Editable < Plan4_Editable then
              alert("Date Plan 5 cannot be less than Date Plan 4")
          else
              "ok"
          end and
      (
              let curRec := this;
              let xDate := cnt(select Holidays where Date = curRec.Plan5_Editable);
              if xDate > 0 then
                  let result := dialog("", " Thid DATE is a HOLIDAY Date. We Proceed ?", ["Si", "No"]);
                  if result = "No" then
                      Plan5_Editable := false
                  end
              end
          )
      • Ninox-Professional
      • planoxpro
      • vor 4 Monaten
      • Gemeldet - anzeigen

       

      Hi Rafel, I don't understand what your script does exactly, but if it works, it's good.

      I have a table called "Feiertage" in which all holidays up to 2040 are entered with a 'Datum' and 'Bezeichnung'. My script above could be expanded as follows if holidays should not be taken into account:

      let myID := this;
      let myDay := Beginn;
      let lastDay := Ende;
      while myDay <= lastDay do
         if weekday(myDay) < 5 then
            if cnt(select Feiertage where Datum = myDay) < 1 then
               let neuEintrag := (create 'Einträge');
               neuEintrag.(Planung := myID);
               neuEintrag.(Datum := myDay)
            end
         end;
         myDay := myDay + 1
      end
      
      • Rafael_Sanchis
      • vor 4 Monaten
      • Gemeldet - anzeigen

      Thanks. 👍

      The first alert won't let me include a Plan Date 5 less than the plan date 4.

       The second alert Date Plan 5 does not allow me to include a holiday date

      https://youtu.be/avuWOAcXS58?feature=shared

Content aside

  • vor 4 MonatenZuletzt aktiv
  • 7Antworten
  • 53Ansichten
  • 3 Folge bereits