Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datawindow setItem to column default value

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
how to setItem a field in a dw into its column default value ? i mean, column default that set in database

thx
 
I am not sure what you are asking. If you want the column to have a default value when you retrieve the data you can set it in the SQL. In PB 6.5 you can set an initial value in the "Column Specifications" menu item under Row. In PB 7 and 8 "Column Specifications" is in the View menu item. Depending on what version of PB you are using there are other ways. If you still need help let me know what version of PowerBuilder you are using and what you want to do and I will try to help.
 
Hi,

You need to scan the System tables in your RDBMS to find the default values for the columns using some embded-SQL. In Oracle, the name of the table/view that stores this info is: ALL_TAB_COLUMNS (you need to figure our the System table/view name for other RDBMSs). So, your SQL should look something similar to this:

//////////////////////////////////////////////////////////
SELECT DATA_DEFAULT INTO :<var>
FROM ALL_TAB_COLUMNS
WHERE OWNER = <owner> AND
TABLE_NAME = <table> AND
COLUMN_NAME = <col>
USING SQLCA ;
//
IF SQLCA.SQLCode = 0 THEN
dw.Object.<col>.[ row ] = <var>
END IF ;
//////////////////////////////////////////////////////////


Regards,

--
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top