Domino 9 und frühere Versionen > ND6: Entwicklung
Datumswert auslesen
flaite:
versuch mal:
--- Code: ---D:= @toTime(Datum);
--- Ende Code ---
koehlerbv:
Dann stimmt aber diese Aussage nicht, wenn es mit @TextToTime bzw. @ToTime funktionieren würde:
--- Zitat von: schikoli am 02.01.06 - 12:26:07 ---ich habe in meiner Maske ein field Datum (type Date) ...
--- Ende Zitat ---
schikoli:
Hallo,
ich habe eben das feld Datum vom Typ Date/time auf Text gesetzt und
D:= @totime(Datum) definiert.
es werden auch so keine Werte ausgelesen bzw umgerechnet.
Bernard,
ich lasse jetzt wieder Datum als Type Date/time und field KW als Text.
ich habe leider noch nicht verstanden was du meintest mit, dass der Inhalt des Feldes Datum nicht vom Typ Datum/Zeit ist, denn als solchen habe ich ja das Feld Datum definiert.
Gibt es eine Art Debugging Fkt unter Lotus Designer?
gossifu:
Hallo,
ich hab das mal nachgestellt, ein Datumsfeld 'Datum' und ein KW - Feld KW.
D habe ich mit
D:= @If(Datum = "";@Today;Datum);
berechnet. Rest deiner Formel genommen.
Funzt einwandfrei.
Kjeld
(
D:= @If(Datum = "";@Today;Datum);
REM {D := [31/12/95]};
FirstOfYear := @Date(@Year(D); 1; 1);
LastOfYear := @Date(@Year(D); 12; 31);
FirstDayNum := @Weekday(FirstOfYear);
LastDayNum := @Weekday(LastOfYear);
REM {ISO weeks start on Monday and ends on Sunday.};
ISOFirstDayNum := @If(FirstDayNum = 1; 7; FirstDayNum - 1);
ISOLastDayNum := @If(LastDayNum = 1; 7; LastDayNum - 1);
REM {The first and last ISO week is the first};
REM {and last ISO week to include Thursday};
IsFirstWeek := 7 - ISOFirstDayNum > 2;
IsLastWeek := 7 - ISOLastDayNum < 4;
REM {The date of the first day of the first ISO week};
ISOFirstDay := @If(IsFirstWeek;
@Adjust(FirstOfYear; 0; 0; 1 - ISOFirstDayNum; 0; 0; 0);
@Adjust(FirstOfYear; 0; 0; 8 - ISOFirstDayNum; 0; 0; 0));
REM {The date of the last day of the last ISO week};
ISOLastDay := @If(IsLastWeek;
@Adjust(LastOfYear; 0; 0; 7 - ISOLastDayNum; 0; 0; 0);
@Adjust(LastOfYear; 0; 0; -ISOLastDayNum; 0; 0; 0));
REM {Date outside ISOFirstDay and ISOlastDay};
REM {are from the previous or next year};
REM {Return the ISO week number and exit};
FirstWeekNextYear := @If(D > ISOLastDay; @Return(@Prompt([Ok]; "FWNY";
@Text(@Year(D)+1) + "W01")); NULL);
REM {I suspect this is where Julian dates would be useful};
REM {A recursive call could be used in a real language};
LastWeekLastYear := (D - @Adjust(FirstOfYear; -1; 0; 0; 0; 0; 0))/60/60/24/7;
AdjustLastWeek := 1 - (LastWeekLastYear - @Integer(LastWeekLastYear));
@Set("LastWeekLastYear"; LastWeekLastYear + AdjustLastWeek);
@If(D < ISOFirstDay;
@Return(@Prompt([Ok]; "LWLY"; @Text(@Year(D) - 1) + "W" +
@Text(LastWeekLastYear))); NULL);
REM {If you get this far, the date falls into an ISO week this year};
REM {Convert the difference in seconds to weeks};
NumWeeks := (D - ISOFirstDay)/60/60/24/7;
REM {Fractions indicate that the date falls};
REM {in the middle of the ISO week};
WeekAdjust := 1 - (NumWeeks - @Integer(NumWeeks));
ISOWeekNum := NumWeeks + WeekAdjust;
REM {Conform to ISO 8601 format};
Pad:=@If(ISOWeekNum<10;"0";"");
Result := @Text(ISOWeekNum);
Result
)
flaite:
--- Zitat von: koehlerbv am 02.01.06 - 13:40:18 ---Dann stimmt aber diese Aussage nicht, wenn es mit @TextToTime bzw. @ToTime funktionieren würde:
--- Zitat von: schikoli am 02.01.06 - 12:26:07 ---ich habe in meiner Maske ein field Datum (type Date) ...
--- Ende Zitat ---
--- Ende Zitat ---
Wie du weisst, kann man nicht sicher sein, ob das Feld im Dokument tatsächlich date/time ist, nur weil das zufällig in der Maske steht.
Vielleicht noch auf nicht null überprüfen...
--- Code: ---@If(@IsNull(Datum); "";@toTime(Datum)):
--- Ende Code ---
Navigation
[0] Themen-Index
[*] Vorherige Sete
Zur normalen Ansicht wechseln