Specifies a display format for a column in a DataWindow control or DataStore.
SetFormatByColNum A separate method name is provided as an alternative syntax for the Web DataWindow server component, which cannot use overloaded methods.
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore object |
Web |
Server component |
Web ActiveX |
DataWindow control, DataWindowChild object |
integer dwcontrol.SetFormat ( string column, string format ) integer dwcontrol.SetFormat ( integer column, string format )
Web DataWindow server component
short dwcontrol.SetFormat ( string column, string format ) short dwcontrol.SetFormatByColNum ( short column, string format )
number dwcontrol.SetFormat ( string column, string format ) number dwcontrol.SetFormat ( number column, string format )
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, DataStore, or child DataWindow. |
column |
The column for which you are specifying the display format. Column can be a column number or a column name. |
format |
A string whose value is the display format for the DataWindow column. |
Returns 1 if it succeeds and –1 if an error occurs. The return value is usually not used.
If any argument’s value is null, in PowerBuilder and JavaScript the method returns null.
For information on valid display formats for different datatypes, see the Users Guide.
If you are specifying the display format for a number, the format must use U.S. notation. For example, comma (,) represents the thousands delimiter and period (.) represents the decimal place. At runtime, the locally correct symbols will be displayed.
An EditMask edit style supersedes any display format applied to the column. When the column has an EditMask edit style, calling SetFormat has no effect.
These statements define the display format for column 15 of dw_employee to the contents of format1:
string format1
format1 = "$#,##0.00"
dw_employee.SetFormat(15, format1)