Hello! I need help :)
I have a doubt that I do not know how to do it.
I want to validate the hours field and the minutes field in this way:
• From April 1 to September 30, effective hours will be 7.
• From October 1 to March 31, the effective hours will be 7 and the minutes will be 33.
in my code:
a!sideBySideItem( item: a!integerField( labelPosition: "ABOVE", value: ri!Regis.hours, saveInto: {ri!Regis.hours}, align: "LEFT" ), width: "MINIMIZE" ), a!sideBySideItem( item: a!textField( labelPosition: "ABOVE", value: " Hours ", readOnly: true ), width: "MINIMIZE" ), a!sideBySideItem( item: a!integerField( labelPosition: "ABOVE", value: ri!Regis.minute, saveInto: {ri!Regis.minute} ), width: "MINIMIZE" ), a!sideBySideItem( item: a!textField( labelPosition: "ABOVE", value: " Minute", readOnly: true ) )
thanks so much!!
Discussion posts and replies are publicly visible
load( local!date, local!hours, local!minute, local!validationData, { a!dateField( label: "Date", value: local!date, saveInto: { local!date, a!save( local!validationData, if( isnull( local!date ), {}, if( and( local!date >= todate( concat( "04/01/", year( local!date ) ) ), local!date <= todate( concat( "09/30/", year( local!date ) ) ) ), { hours: 7, minutes: 0 }, { hours: 7, minutes: 30 } ) ) ), a!save( local!hours, null ), a!save( local!minute, null ) } ), a!sideBySideLayout( items: { a!sideBySideItem( item: a!integerField( labelPosition: "ABOVE", value: local!hours, saveInto: { local!hours }, align: "LEFT", readOnly: if( isnull( local!date ), true(), false() ), validations: if( isnull( local!hours ), {}, if( local!hours > tointeger( local!validationData.hours ), "Not Valid", {} ) ) ), width: "MINIMIZE" ), a!sideBySideItem( item: a!textField( labelPosition: "ABOVE", value: " Hours ", readOnly: true ), width: "MINIMIZE" ), a!sideBySideItem( item: a!integerField( labelPosition: "ABOVE", value: local!minute, saveInto: { local!minute }, readOnly: if( isnull( local!date ), true(), false() ), validations: if( isnull( local!minute ), {}, if( local!minute > tointeger( local!validationData.minutes ), "Not Valid", {} ) ) ), width: "MINIMIZE" ), a!sideBySideItem( item: a!textField( labelPosition: "ABOVE", value: " Minute", readOnly: true ) ) } ) })
As this example that has happened to me, I should be alone. It gives me back 7 what I write. Now I should measure up to the date of October 1 to March 31 and keep me 7 and 33
if (or (todate (now ())> = todate ("4/1 /", year (now ())),todate (now ()) <= todate ("9/30 /", year (now ()))),7,30)
if( /*From April 1 to September 30 */ and( today() >= todate( concat( "04/01/", year( today() ) ) ), today() <= todate( concat( "09/30/", year( today() ) ) ) ), /*true means date is in between April 1 to September 30*/ { hours: 7, minutes: 0 }, /*false means date is in between October 1 to March 31*/ { hours: 7, minutes: 33 } )
Thank you so much for helping me!!