Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6068 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!

Posted

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

Posted

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.

Posted

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])

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.