of_converttorow


pfcapsrv.pbl   >   pfc_n_cst_tvsrv_levelsource   >   of_converttorow   

Full name pfc_n_cst_tvsrv_levelsource.of_converttorow
Access public
Extend of integer
Return value integer
Prototype public function integer of_converttorow(long,string[],ref n_ds,ref long)

Name Datatype
No Data

Name Datatype
li_cnt Integer
li_columns Integer
li_index Integer
li_newlevel Integer
ls_Sqlerr string
ltvi_parent treeviewitem
lw_parentwindow window

public function integer of_converttorow (long al_parent, string aa_columnvalues[], ref n_ds ads_obj, ref long al_row);//////////////////////////////////////////////////////////////////////////////
//
//	Function:	of_converttorow
//
//	Access:		public
//
//	Arguments:
//	al_Parent			The handle to the parent we want to add the item to
//	aa_ColumnValues[]	The array containing the data to be used for the new row.
//	ads_obj				The datastore to place the new row in (the dataobjects should have
//								the same column types).  Passed by reference
//	al_Row				The new row of the array in the datastore.  Passed by reference
//
//	Returns:		Integer
//					 1 if successful
//					-1 if an error occurrs.
//
//	Description:	Convert an array of values which corresponded to columns in the 
//						source dataobject to a row in a datastore.  A row does not have to
//						be added to the data source first using this method
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
Integer				li_columns, li_cnt, li_newlevel, li_index
string				ls_Sqlerr
window				lw_parentwindow
treeviewitem		ltvi_parent

// check reference variables
If IsNull(itv_requestor) or Not IsValid(itv_requestor) Then Return -1

// check arguments
If (al_parent < 0) or IsNull(al_parent) then Return -1
li_columns = UpperBound(aa_columnvalues)
If (li_columns < 1) or IsNull(li_columns) then Return -1

// Find the Treeview Level to insert the item on
If al_Parent <> 0 Then
	If itv_requestor.GetItem(al_Parent, ltvi_Parent) = -1 Then Return -1
	li_NewLevel = ltvi_Parent.Level + 1
Else
	li_NewLevel = 1
End If

// Get index into the data source array
li_Index = UpperBound(inv_attrib)
If li_NewLevel <= li_Index Then
	li_Index = li_NewLevel
Else
	// If new item is being added to a level > li_Index then
	// inv_attrib[li_Index] must be recursive
	If Not inv_attrib[li_Index].ib_Recursive Then Return -1
End If

// Populate the storage datastore
If inv_attrib[li_Index].is_method = inv_cache.SQL then
	ads_obj.Create( inv_attrib[li_Index].is_dataobject, ls_sqlerr )
	If Len(ls_sqlerr) > 0 Then
		Return -1		
	End If 	
Else
	ads_obj.DataObject = inv_attrib[li_Index].is_dataobject
End If
ads_obj.of_SetBase(true)
itv_requestor.of_GetParentWindow(lw_parentwindow)
ads_obj.of_SetParentWindow(lw_parentwindow)

al_row = ads_obj.InsertRow(0)
If al_row < 1 Then 
	Return -1
End If

// copy the argument array to the datastore column by column
For li_cnt = 1 to li_columns
	ads_obj.object.data[al_row, li_cnt] = aa_columnvalues[li_cnt]
End For

return 1

end function

     
Name Owner
pfc_u_tvs.of_additem pfc_u_tvs
pfc_u_tvs.of_insertitem pfc_u_tvs

     
Name Owner
treeview.getitem treeview
datastore.create datastore
datastore.insertrow datastore
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.upperbound systemfunctions
pfc_u_tvs.of_getparentwindow pfc_u_tvs
pfc_n_ds.of_setbase pfc_n_ds
pfc_n_ds.of_setparentwindow pfc_n_ds

     
Full name
No Data

     
Name Scope
No Data