Cardiofuse Posted June 8, 2008 Posted June 8, 2008 I have a time field (Time OnCPBP) in which I can set a script to enter the current time; however when I want to enter the military time manually, I use the Auto-Enter Calculated value specified as: Let ( [ TheText=GetAsText(Time OnCPBP); Reformat=(PatternCount(TheText;":")=0); RawNumber=GetAsNumber(TheText) ]; Case(Reformat; Time(Div(RawNumber;100); Mod(RawNumber;100) ;0); Time OnCPBP)) This lets me enter the four digits and it inserts the semi-colon for me (much easier) for my users.... Problem: I have another time field (On CPBP #2) in which the calculated value is specified as: If (Event = "On CPBP #2"; Time), so whenever the "Event" field is "On CPBP #2) the time gets entered automatically. The caveat is, I would also like to enter the 4-digit method manually and format as above but I'm having trouble combining the two calculations. Any thoughts, not sure why this stumped me. I thought something like: If (Event = "On CPBP #2"; Time) + Let ( [ TheText=GetAsText(Time OnCPBP #2); Reformat=(PatternCount(TheText;":")=0); RawNumber=GetAsNumber(TheText) ]; Case(Reformat; Time(Div(RawNumber;100); Mod(RawNumber;100) ;0); Time OnCPBP #2)) I guess my basic problem is how to "nest" these two formula together. Each works separately but I need them both in this field. Thanks to anyone!
comment Posted June 9, 2008 Posted June 9, 2008 Try something like: Case ( Get (ActiveFieldName) = "On CPBP #2" ; ; Event = "On CPBP #2" ; Get (CurrentTime) ; On CPBP #2 )
Cardiofuse Posted June 12, 2008 Author Posted June 12, 2008 Thank you; that was a pathway I did not think of. I entered it as: Case(Get ( ActiveFieldName ) = "Time OnCPBP#2"; Let ( [ TheText=GetAsText(Time OnCPBP#2); Reformat=(PatternCount(TheText;":")=0); RawNumber=GetAsNumber(TheText) ]; Case(Reformat; Time(Div(RawNumber;100); Mod(RawNumber;100) ;0); Time OnCPBP#2); Event = "On CPBP #2"; Get ( CurrentTime ); Time OnCPBP#2) .....and I get the usual error message "There are too many parameters in this function" Any thoughts. I have used the actual field names here. Thanks for the effort
comment Posted June 12, 2008 Posted June 12, 2008 This is not easy to read, but I think you're missing a parenthesis to close the Let() function.
Cardiofuse Posted June 12, 2008 Author Posted June 12, 2008 The Let() seems to work fine alone as....... Let ( [ TheText=GetAsText(Time OnCPBP#2); Reformat=(PatternCount(TheText;":")=0); RawNumber=GetAsNumber(TheText) ]; Case(Reformat; Time(Div(RawNumber;100); Mod(RawNumber;100) ;0); Time OnCPBP#2)) ....this allows me to manually enter a 4 digit number and it will place the colon in to create a military time. For some reason, I can't seem to auto enter the Time, when the Event field="On CPBP#2" ....I can do this separately without the Let function but I can't get them to work together.
comment Posted June 12, 2008 Posted June 12, 2008 The Let() seems to work fine alone as....... Let ( [ TheText=GetAsText(Time OnCPBP#2); Reformat=(PatternCount(TheText;":")=0); RawNumber=GetAsNumber(TheText) ]; Case(Reformat; Time(Div(RawNumber;100); Mod(RawNumber;100) ;0); Time OnCPBP#2)[color:red])
Recommended Posts
This topic is 6068 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now