PowerBuilder Forum

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Creating Dynamic DataWindows from SQL


Veteran Member

Status: Offline
Posts: 40
Date:
Creating Dynamic DataWindows from SQL


Rather than creating multiple DataWindows, which basically did the same thing, I was in need of a simple solution which I could get a simple list of objects dynamically in code... This is the general idea of the solution:

// my transaction object is a global variable, loaded at runtime, named Master_Trans
String ls_sql, ls_syntax, ls_err
Long ll_row, ll_cust
DataStore lds_info

ls_sql = 'SELECT CUST_NO FROM ORDER_MASTER GROUP BY CUST_NO ORDER BY CUST_NO'
ls_syntax = Master_Trans.SyntaxFromSQL( ls_sql, '', ls_err )

IF ls_err <> '' THEN
MessageBox( 'Error...', ls_err )
RETURN
END IF

lds_info = CREATE DataStore
lds_info.Create( ls_syntax )
lds_info.SetTransObject( Master_Trans )
lds_info.Retrieve( )

FOR ll_row = 1 TO lds_info.RowCount( )
ll_cust = lds_info.GetItemNumber( ll_row, 'cust_no' )
// the unique customer number is now in the local variable!
NEXT

DESTROY lds_info


-- Edited by thekl0wn on Wednesday 8th of April 2009 02:32:35 PM

__________________


Newbie

Status: Offline
Posts: 1
Date:

uf_ds_from_sql() to create DataStore by dynamic SELECT



__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard