Deki Djokic wrote:
Hello Drew,A bit more complicated under Base, unfortunately. The dataform has an event"Before record action". If we add the following procedure and function to a library and assignt the onBeforeRecordAction procedure to this event you will have the funcitonal equivilant to what you did in MSA. sub onBeforeRecordAction( oEv as object ) dim dtField dim wkField if oEv.Action = 2 then if oEv.Source.ImplementationName <> "com.sun.star.form.FmXFormController" then dtField = oEv.Source.getByName( "DateField" ).BoundField wkField = oEv.Source.GetByName( "fmtWeek" ).BoundField wkfield.updateInt( getWeek( oEv.Source.ActiveConnection, dtField.Value ) ) end if end if end sub function getWeek( aConn as variant, aDate as new "com.sun.star.util.Date" ) dim stmt dim rs stmt = aConn.CreateStatement rs = stmt.executeQuery( "CALL WEEK( '" & aDate.Year & "-" & aDate.Month & "-" & aDate.Day & "' ) " ) rs.next getWeek = rs.getInt( 1 ) end functionOne item woth mentioning is that the WEEK function does not use ISO8601 ( I think that is it ) numbering - instead it always starts with week 1 for the week containing JAN 1, so 2005-12-28 is week 53, not 52. Drew |
- Re: [dba-users] OOoBase - Exa... Frank Schönheit - Sun Microsystems Germa ny
- Re: [dba-users] OOoBase ... Andrew Jensen
- Re: [dba-users] OOoB... Frederick Frazelle
- Re: [dba-users] OOoBase ... Andrew Jensen
- Re: [dba-users] OOoB... Deki Djokic
- Re: [dba-users] ... Andrew Jensen
- Re: [dba-use... Deki Djokic
- Re: [db... Andrew Jensen
- Re: [db... Andrew Jensen
- Re: [db... Andrew Jensen
- Re:... Deki Djokic
