from PB, I have
datastore lds
lds = create datastore
lds.dataobject = ‘d_common’
this d_common datawindow is created by stored-procedure-1.
at runtime, I want to change the d_common stored-procedure-1
to stored-procedure2.
Is it possible. If so, please show me how
(PB9).
TIA.
Doug Porter
DailyAccess Corporation
<MH> wrote in message news:4326fa05.39a...@sybase.com...
Rather than create the DW from the first SP why not create dynamicaly
at run time. I have cut the following code from something we use but
hopefully I have left enough to give you the idea.
If you have create a datastore object (base_n_ds) and put the following
code into a function of_SetSPName.
ls_FROMSQL = "execute " + as_spname + ";"
ls_SQL = SQLCA.SyntaxFromSQL(ls_FROMSQL, 'Style(Type=Form)',
is_Errtext)
IF Len(is_Errtext) > 0 THEN
lb_status = FALSE
ELSE
// Generate datawindow with the SQL
This.Create(ls_SQL, is_Errtext)
IF Len(is_Errtext) > 0 THEN
lb_status = FALSE
END IF
END IF
IF (lb_status) THEN
//set trans object and test for errors
li_rtn_val = This.of_settransobject ( SQLCA ) // Sets Transaction
Object
IF li_rtn_val <> 1 THEN
is_Errtext = 'ERROR;On Setting TransactionObject for the
Datastore'
lb_status = FALSE
END IF
END IF
IF (lb_status) THEN
// 2. set each column as updateable
li_colcount = Integer(This.Object.DataWindow.Column.Count)
FOR li_col = 1 TO li_colcount
This.Modify(This.Describe( "#"+string(li_Col)+".Name") +
'.Update=Yes')
//ids_data.Modify(lds_TabTo.Describe(
"#"+string(li_Col)+".Name") + '.Key=Yes')
NEXT
//3. set table name and set as updateable and set parameters for
default where
DWObject ldw
ldw = This.Object.DataWindow
ldw.Table.UpdateTable = as_TableName
ldw.Table.UpdateWhere = 0 // key columns only in
where
ldw.Table.UpdateKeyInPlace = 'yes' // key changes treated as
Updates
END IF
Then use above by:
lds_xxx = CREATE base_n_ds
ls_TAB = 'name_of_base_table'
IF NOT lds_xxx.of_SetSPName(ls_INS, ls_TAB) THEN
of_ReportError ( FunctionName, lds_xxx.is_ErrText )
Return Failure
END IF
If you only intend the DW for retrieve you can remove the use of
as_TableName