If you have field rules in place to transform a person's last name with the transform command of Low & Word, in other words make the name all lower case and then capitalize the first word you may have run into situations where that doesn't provide the answer you want all the time.
For example, if the name is McDonald, using the fields rules listed above, the name will be converted to Mcdonald. The field rules do allow you, in the Transform, tab to edit an exceptions table to make provision for the proper capitalization. That does mean that the user has to get to the field rules to do that. That of course is not a good thing and also what do you do in a network situation so that all users can have the same exceptions file.
I found a work around. The exceptions are stored in the computer's c drive in the Alpha Five shared folder and is called a_case.dbf (Thanks Stan).
To resolve the issue:
1. Copy (not move or delete) the a_case table from your shared folder on your c drive to the folder where your database is.
2. Add the table to your database.
3. Create a simple browse screen for users to update.
4. Create a new function called case_convert() (listed below)
5. Add a line to your autoexec script like this:
result = case_convert()
The case_convert() function will then copy unique entries to the users local c drive from the database. Then all users will have the same thing to share, they don't have to go to field rules and it will be automatically updated each time they open the database. You could do a button to manually update the the local c drive or add an event to the network a_case table to update the local machine when they a new entry.
The function returns a true/false when it run so you can do some error trapping if you wanted.
Here is the function:
'Date Created: 26-Mar-2010 10:27:27 AM
'Last Updated: 26-Mar-2010 10:38:45 AM
'Created By : mike
'Updated By : mike
FUNCTION case_convert AS L ( )
DIM Append as P
a_tbl = table.open(a5.Get_Shared_Path() + chr(92) +"a_case")
append.t_db = a5.Get_Path() + chr(92) + "a_case.dbf"
ON ERROR GOTO ERROR26032010103440457
append.m_key = "old"
append.t_key = "old"
append.m_filter = ""
append.t_filter = ""
append.type = "Unique, replace existing"
append.m_count = 2
append.m_case1 = "EITHER"
append.m_field1 = "OLD"
append.m_exp1 = "@A_CASE->OLD"
append.m_case2 = "EITHER"
append.m_field2 = "NEW"
append.m_exp2 = "@A_CASE->NEW"
append.t_count = 0
a_tbl.append()
GOTO CONTINUE26032010103440457
ERROR26032010103440457:
ON ERROR GOTO 0
'ui_msg_box("Error","Error running Append Operation"+crlf()+error_text_get())
case_convert = .f.
END
CONTINUE26032010103440457:
a_tbl.close()
case_convert = .t.
END FUNCTION
For example, if the name is McDonald, using the fields rules listed above, the name will be converted to Mcdonald. The field rules do allow you, in the Transform, tab to edit an exceptions table to make provision for the proper capitalization. That does mean that the user has to get to the field rules to do that. That of course is not a good thing and also what do you do in a network situation so that all users can have the same exceptions file.
I found a work around. The exceptions are stored in the computer's c drive in the Alpha Five shared folder and is called a_case.dbf (Thanks Stan).
To resolve the issue:
1. Copy (not move or delete) the a_case table from your shared folder on your c drive to the folder where your database is.
2. Add the table to your database.
3. Create a simple browse screen for users to update.
4. Create a new function called case_convert() (listed below)
5. Add a line to your autoexec script like this:
result = case_convert()
The case_convert() function will then copy unique entries to the users local c drive from the database. Then all users will have the same thing to share, they don't have to go to field rules and it will be automatically updated each time they open the database. You could do a button to manually update the the local c drive or add an event to the network a_case table to update the local machine when they a new entry.
The function returns a true/false when it run so you can do some error trapping if you wanted.
Here is the function:
'Date Created: 26-Mar-2010 10:27:27 AM
'Last Updated: 26-Mar-2010 10:38:45 AM
'Created By : mike
'Updated By : mike
FUNCTION case_convert AS L ( )
DIM Append as P
a_tbl = table.open(a5.Get_Shared_Path() + chr(92) +"a_case")
append.t_db = a5.Get_Path() + chr(92) + "a_case.dbf"
ON ERROR GOTO ERROR26032010103440457
append.m_key = "old"
append.t_key = "old"
append.m_filter = ""
append.t_filter = ""
append.type = "Unique, replace existing"
append.m_count = 2
append.m_case1 = "EITHER"
append.m_field1 = "OLD"
append.m_exp1 = "@A_CASE->OLD"
append.m_case2 = "EITHER"
append.m_field2 = "NEW"
append.m_exp2 = "@A_CASE->NEW"
append.t_count = 0
a_tbl.append()
GOTO CONTINUE26032010103440457
ERROR26032010103440457:
ON ERROR GOTO 0
'ui_msg_box("Error","Error running Append Operation"+crlf()+error_text_get())
case_convert = .f.
END
CONTINUE26032010103440457:
a_tbl.close()
case_convert = .t.
END FUNCTION
Comment