of_getlevel


pfcapsrv.pbl   >   pfc_n_cst_tvsrv_levelsource   >   of_getlevel   

Full name pfc_n_cst_tvsrv_levelsource.of_getlevel
Access public
Extend of integer
Return value integer
Prototype public function integer of_getlevel(n_ds)

Name Datatype
No Data

Name Datatype
lds_test n_ds
li_Level Integer
li_Limit Integer
ls_newsyntax String
ls_sqlerr String
ls_syntax String

public function integer of_getlevel (n_ds ads_obj);//////////////////////////////////////////////////////////////////////////////
//
//	Function:	of_GetLevel
//
//	Access:		public
//
//	Arguments:
//	ads_obj		The datastore object to find the level for.
//
//	Returns:		Integer
//					 # of the level the datastore object populates if successful
//					-1	if an error occurs
//
//	Description:	Find the level the datastore object populates. 
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_Level, li_Limit
String		ls_syntax, ls_sqlerr, ls_newsyntax
n_ds			lds_test

If IsNull(ads_obj) or Not Isvalid(ads_obj) Then Return -1

// Determine proper element in the data source structure
li_Limit = UpperBound(inv_attrib)
For li_Level = 1 to li_Limit
	// compare to datawindow defined for level
	If inv_attrib[li_Level].is_dataobject = ads_obj.dataobject then
		Return li_Level
	End If
	// check for SQL as source
	If ads_obj.dataobject = "" AND inv_attrib[li_level].is_method = inv_cache.SQL then
		ls_syntax = ads_obj.object.DataWindow.Syntax
		// create temporary datastore 
		lds_test = Create n_ds
		lds_test.Create( inv_attrib[li_Level].is_dataobject, ls_sqlerr )
		If Len(ls_sqlerr) > 0 Then
			Destroy lds_test
			Continue		
		End If 	
		ls_newsyntax = lds_test.object.Datawindow.Syntax
		Destroy lds_test
		// if syntax is the same we have the right level
		If ls_syntax = ls_newsyntax then
			return li_level
		end if
	end if
Next

return -1
end function

     
Name Owner
pfc_n_cst_tvsrv_levelsource.of_setitemattributes pfc_n_cst_tvsrv_levelsource
pfc_n_cst_tvsrv_levelsource.of_gethandle pfc_n_cst_tvsrv_levelsource

     
Name Owner
datastore.create datastore
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.upperbound systemfunctions

     
Full name
No Data

     
Name Scope
No Data