Topic: changing to uppercase direct entry in tablegrid

I share here what I have used as a solution to convert filled text fields directly through the tablegrid into uppercase. Insertion or change of record.


SQLexecute(' CREATE TRIGGER IF NOT EXISTS [nome_categoria_upper_insert] AFTER INSERT ON [tbl_categorias] '+
' BEGIN '+
'   UPDATE '+
'     [tbl_categorias] '+
'   SET '+
'     [nome_categoria] = UPPER ([nome_categoria]) '+
'   WHERE '+
'     [rowid] = [NEW].[rowid]; '+
' END; ')

SQLexecute(' CREATE TRIGGER IF NOT EXISTS [nome_categoria_upper_insert] AFTER UPDATE ON [tbl_categorias] '+
' BEGIN '+
'   UPDATE '+
'     [tbl_categorias] '+
'   SET '+
'     [nome_categoria] = UPPER ([nome_categoria]) '+
'   WHERE '+
'     [rowid] = [NEW].[rowid]; '+
' END; ')
Roberto Alencar

Re: changing to uppercase direct entry in tablegrid

Hi Roberto,
Thanks for the suggestion.
Could you not also just set the 'charcase' object property to 'edlower', 'ednormal' or 'edupper' using standard MVD functionality (see screenshot in the attachment) to force data to be saved in a consistent format?
And if you have inherited a lot of data from a legacy system that needs to be cleaned up, I would just use something like a button attached to a small scriptto tidy the data.  Then when I'm happy with the quality of the data, just delete the script if it's no longer needed.
Regards,
Derek.

Post's attachments

Attachment icon change case.zip 513.08 kb, 52 downloads since 2023-09-15 

3 (edited by jrga 2023-09-15 23:29:41)

Re: changing to uppercase direct entry in tablegrid

Hi Derek, thanks for showing another alternative!
I always use the options you put in the attachment. But my script is for the case of data that will be inserted and edited only through a tablegrid. I would like to know more about triggers. For example, how to update the stock balance with each entry and exit of items. But my idea would be to place the trigger inside the database using the freeware SqliteExpert, which is what I did with the "capital letters" for the data inserted and edited through the tablegrid. If you know of any sources of information, I would appreciate it.

Roberto Alencar