of_createkey


pfcmain.pbl   >   pfc_u_lv   >   of_createkey   

Full name pfc_u_lv.of_createkey
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_createkey()

Name Datatype
No Data

Name Datatype
lb_First Boolean
li_Cnt Integer
li_Obj Integer
ls_Exp String
ls_mod String
ls_Obj String[]

protected function integer of_createkey ();//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_CreateKey
//
//	Access:  protected
//
//	Arguments:	None.
//
//	Returns:		Integer
//					1	- the key was created successfully
//					-1	- the DataWindow object did not have any key columns assigned
//
//	Description:	Add a computed column to the DataWindow object that will contain 
//						all the keys concatenated together.  This is necessary to be able to 
//						find a unique row.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//	6.0	Corrected multiple numeric key columns concatenation problem
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

String	ls_Exp, ls_Obj[], ls_mod
Integer	li_Obj, li_Cnt
Boolean	lb_First

ls_Exp = "expression='"
lb_First = True
li_Obj = ids_Source.inv_base.of_GetObjects(ls_Obj, "*", "*", False)

For li_Cnt = 1 To li_Obj
	If ids_Source.Describe(ls_Obj[li_Cnt] + ".key") = "yes" Then
		If Not lb_First Then
			ls_Exp = ls_Exp + " + "
		Else
			lb_First = False
		End if
		ls_Exp = ls_Exp + 'String(' + ls_Obj[li_Cnt] + ') + "' + is_pfckeydelimiter + '"'
	End if
Next

If lb_First Then
	// No key columns were defined
	Return -1
Else
	ls_Exp = ls_Exp + "'"
End if

ls_mod = ids_Source.Modify("create compute(band=detail x='0' y='0' visible='0' " + &
							"height='0' width='0' name=pfc_lvi_key " + ls_Exp + ")")
if Len (ls_mod) > 0 then
	return -1
else
	return 1
end if


end function

     
Name Owner
pfc_u_lv.of_setdatasource pfc_u_lv

     
Name Owner
datastore.describe datastore
datastore.modify datastore
systemfunctions.len systemfunctions
pfc_n_cst_dssrv.of_getobjects pfc_n_cst_dssrv

     
Full name
No Data

     
Name Scope
No Data