January 11, 200521 yr Newbies 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. Thanks for your time, Carl
January 11, 200521 yr 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.
January 12, 200521 yr Author Newbies 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
January 12, 200521 yr 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" ) )
January 13, 200521 yr Author Newbies 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
January 13, 200521 yr 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.
January 15, 200521 yr Author Newbies 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. 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.
January 25, 200520 yr Author Newbies 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.
Create an account or sign in to comment