clear if file('transform_string1.dbf') drop table transform_string1 endif if not file('transform_string1.dbf') create table transform_string1 (numStr character(15),nNum int) use transform_string1 generate 30 use delete from transform_string1 where nNum = 0 or nNum > 900000 update transform_string1 set numStr = cast(nNum as char(10)) //Saves values without leading spaces alter table transform_string1 drop nNum //Code above is used to create a test table with a field containing //integers as strings withut leading spaces. endif //The code below adds a new character fields to the table and then //populates the new field from the original field with commas //inserted to mark thousands. set procedure to insert_k_marker.prg //Only necessary if .prg is not in the same folder as the .wfm file //Add a path or sourcecode alias try alter table transform_string1 drop NewNumStr catch( exception e ) endtry alter table transform_string1 add NewNumStr char(12) //extra spaces to allow for comas use transform_string1 scan cStr = insert_k_marker(numStr) //Process field with leading spaces replace NewNumStr with cStr endscan use close procedure insert_k_marker.prg ** END HEADER -- do not remove this line // // Generated on 2023-11-14 // parameter bModal local f f = new transform_string1Form() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class transform_string1Form of FORM with (this) onClose = class::FORM_ONCLOSE height = 21.5455 left =10.1429 top = 0.0455 width = 54.2857 text = "" endwith this.TRANSFORM_STRING11 = new QUERY(this) with (this.TRANSFORM_STRING11) width = 14.0 height = 1.0 sql = 'select * from "transform_string1.DBF"' active = true endwith this.GRID1 = new GRID(this) with (this.GRID1) dataLink = form.transform_string11.rowset columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN1"]) dataLink = form.transform_string11.rowset.fields["numstr"] editorType = 1 // EntryField width = 21.4286 endwith columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN2"]) dataLink = form.transform_string11.rowset.fields["newnumstr"] editorType = 1 // EntryField width = 17.1429 endwith with (columns["COLUMN1"].headingControl) value = "numStr" endwith with (columns["COLUMN2"].editorControl) function = "J" endwith with (columns["COLUMN2"].headingControl) value = "NewNumStr" endwith height = 14.6818 left = 4.0 top = 5.1818 width = 44.7143 endwith this.TEXT1 = new TEXT(this) with (this.TEXT1) height = 3.7273 left = 27.2857 top = 0.4091 width = 23.7143 text = "Uses fuction property of columnentryfield object in grid to right justify the entry. A proporionally spaced font can be used." endwith this.rowset = this.transform_string11.rowset function form_onClose() form.transform_string11.active = false alter table transform_string1 drop NewNumStr //Remove temp field return endclass