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 7311 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I am very new to FMPRO7. I have html and Flash programming experience, so I understand the basics of programming.

Can someone help me get started on creating a solution to the following problems?

- User types in 6 digit number (xxxxxx) tabs out to have 6 digits formatted to xx-xx-xx

- User types in 8 digit number (xxxxxxxx) tabs out to have 8 digits formatted to xx/xx/xxxx

Any advise or help in this matter would be greatly appreciate. smile.gif

Thanks for your time,

Carl

Posted

I assume the input is a text field. Make it auto-enter by calculation and allow the existing value to be replaced. Use the following calculation:

Case ( Length ( TextField ) = 6 ; Left ( TextField; 2 ) & "-" & Middle ( TextField ; 3 ; 2 ) & "-" & Right ( TextField ; 2 ); Length ( TextField ) = 8 ; Left ( TextField; 2 ) & "/" & Middle ( TextField ; 3 ; 2 ) & "/" & Right ( TextField ; 4 ) ; "Error" )

This will show Error if the number of characters are not 6 or 8. If you omit " ; "Error"", the field will return nothing in this case. If you replace "Error" with TextField then what you entered will be returned if the number is 6 or 8 characters.

  • Newbies
Posted

Thanks for the speedy reply. I like what you have done here. I need one for a Medical record field and one for date field. Can you seperate the code into two? Do I need to define fields as date if I'm going to print reports by date range? Thanks for your time,

Carl

Posted

Let( N = Filter( TextField1; "0123456789" );

Case( Length(N) = 6; Left( N; 2 ) & "-" & Middle( N; 3; 2 ) & "-" & Right( N; 2 ); "Error" )

)

The second one will not work on a date field. It will have to be a text field. But you can use a calculated date field of GetAsDate(TextField1) for your searches and reports.

Let( D = Filter( TextField2; "0123456789" );

Case( Length(D) = 8; Left( D; 2 ) & "/" & Middle( D; 3; 2 ) & "/" & Right( D; 4 ); "Error" )

)

  • Newbies
Posted

WOW! That worked perfectly! Thanks again. How do I print a report; field "Destruction Date"(text) by date range? (For example 05/01/2005 - 05/31/2005)

Thank you for your time,

Carl

Posted

Use the GetAsDate calculation field and either manually enter 5/1...5/31 in Find Mode or have a script

Set Error Capture [On]

Enter Find Mode [ ]

Set Field [datefield; globaldatestart & "..." & globaldateend]

Perform Find [ ]

If [Get(FoundCount)]

{do something if records found}

Else

{do something if no records found}

End If

where globaldatestart and globaldateend are two date fields stored as globals whose criteria is entered in Browse Mode.

  • Newbies
Posted

This is good stuff. Again I am a noob and appreciate the help. I like to contribute to forums when ever I can, because I get so much from them. Unfortunately this is not my area of expertise, yet. smile.gif

I like the fact that we can automate tasks in FMPRO7. Can you help me apply the script? I don't know where to begin.

  • 2 weeks later...
  • Newbies
Posted

Thank you for all the great information. I need to add a check digit to my xx-xx-xx entery to read xx-xx-xx-x. Can you help me with the code for this?

I am using the following code:

Let( N = Filter( M.R.#; "0123456789" );

Case( Length(N) = 7; Left( N; 2 ) & "-" & Middle( N; 3; 2 ) & "-" & Middle( N; 5; 2 ) & "-" & Right( N; 1 ); "Error" )

)

Is there a more efficent way?

Need to auto format a seven digit entry of ####### to ##-##-##-#.

Any input would be appreciated.

This topic is 7311 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.