TestofCCS
|
| Posted: 06/25/2002, 1:35 PM |
|
Does anybody know how to convert a field value in UpperCase in CCStudio? I know we use to do it in CC2.0 in BeforeInsert Event
fldAddress=UCase(fldAddress)
But Codecharge Studio does no like the above method.
|
|
|
 |
DavidR
|
| Posted: 06/25/2002, 9:40 PM |
|
Hi, I am also having the same problem, I want some fields to be saved in uppercase in the database. With CC2.0 you can do it easily with events. I tried to do the same in Studio but no luck. None of the examples of CodeChargeStudio shows you the procedure to update/minuplate variables. I tried to put '>' or UCase or Upper in Format but nothing happened.
It must be very simple. Does anybody know how to achieve this simple task???
|
|
|
 |
Nomad
|
| Posted: 06/26/2002, 2:04 AM |
|
Like DavidR I also had to ensure that all updates to my database tables were in uppercase, I achieved this result by going to the 'UpdateRow Method' of the Code and adding the ucase keyword to the field values which I needed to be set to uppercase. For Example:
Function UpdateRow()
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeUpdate", Me)
If NOT UpdateAllowed Then UpdateRow = False : Exit Function
With Command.Parameters
.ParameterSources("ctrlpreferred") = ucase(preferred.Value)
.ParameterSources("ctrlextension") = ucase(extension.Value)
.ParameterSources("ctrldirect") = ucase(direct.Value)
.ParameterSources("ctrlroom") = ucase(room.Value)
.ParameterSources("ctrlempid") = empid.Value
.ParameterSources("ctrlracf") = racf.Value
End With
DataSource.Update(Command)
CCSEventResult = CCRaiseEvent(CCSEvents, "AfterUpdate", Me)
If DataSource.Errors.Count > 0 Then
PrintDBError "Record " & ComponentName & " / Update Operation", DataSource.Connection.LastSQL, DataSource.Errors.ToString()
DataSource.Errors.Clear
Errors.AddError "Database command error."
End If
UpdateRow = (Errors.Count = 0)
End Function
I presume that if the data is stored in the database in non uppercase and you want it displayed on your Form in uppercase then you would need to do something similar within the Show Method part of the Code. Possibly something like this:-
surname.SetDBValue ucase(Recordset.Fields("EMP_SNAME"))
This is were you are setting the value of: in this case the "surname" object with the ucase value taken from the recordset field "EMP_SNAME". Although I have not had an opportunity to test this idea in my own project, I have had an opportunity to do other data manipulation within this area of the code.
|
|
|
 |
|