PowerBuilder Function Checks if a column exists in a DataWindow.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | Global Type gf_col_exist From function_object End Type Forward Prototypes Global Function Boolean gf_col_exist (Readonly datawindow adw, Readonly String as_colname) End Prototypes Global Function Boolean gf_col_exist (Readonly datawindow adw, Readonly String as_colname); /*************************************************************** gf_col_exist Checks if a column exists in a DataWindow. *************************************************************** Arguments: [readonly/DataWindow] adw: Datawindow to search [readonly/string] as_colname: Name of the column to search Returns: boolean true: Column found false: Column not found ***************************************************************/ String ls_test //Check the column.id property. // Describe returns the number of the column if the column exists. // Describe returns an exclamation point (!) if the column doesn't exist. //Check if the column exists... ls_test = adw.Describe(as_colname+'.id') Return ls_test <> "!" End Function |
Good Luck!