of_RegisterReportColumn


pfcapsrv.pbl   >   pfc_n_cst_lvsrv_datasource   >   of_RegisterReportColumn   

Full name pfc_n_cst_lvsrv_datasource.of_RegisterReportColumn
Access public
Extend of integer
Return value integer
Prototype public function integer of_RegisterReportColumn(n_ds,string,string,alignment,integer)

Name Datatype
No Data

Name Datatype
li_Cnt Integer
li_ColCnt Integer
li_Cols Integer
ls_Type string

public function integer of_RegisterReportColumn (n_ds ads_obj, string as_columnname, string as_columnlabel, alignment aal_alignment, integer ai_columnwidth);//////////////////////////////////////////////////////////////////////////////
//	Public Function:	of_RegisterReportColumn
//	Arguments:		ads_obj				The data store which holds the column information of as_columnname
//						as_ColumnName		The column in the DataWindow object to add as a column in the ListView. 
//						as_ColumnLabel		The heading for the column to display in the ListView
//						aal_Alignment		The alignment of the column in the ListView 
//												(Left!, Right!, Center!, Justify!).
//						ai_ColumnWidth		The width of the column in the ListView (in PB Units).
//	Returns:			Integer
//						The index of the column if added successfully
//						-1 if an error occurred
//	Description:	Add a column to the ListView control.  It will be displayed in 
//						Report View only.
//////////////////////////////////////////////////////////////////////////////
//	Rev. History:	Version
//						6.0   Initial version
//////////////////////////////////////////////////////////////////////////////
//	Copyright © 1996-1999 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_Type
Integer	li_Cols, li_Cnt, li_ColCnt

// check reference variables and arguments
if IsNull(ilv_requestor) or not IsValid(ilv_requestor) then return -1
if IsNull(as_columnlabel) or (trim(as_columnlabel) = "") then return -1
if IsNull(as_columnname) or (trim(as_columnname) = "") then return -1
if IsNull(ai_columnwidth) or (ai_columnwidth < 0) then return -1

// Check if the column was previously added
li_Cols = UpperBound(inv_ColAttrib)
for li_Cnt = 1 to li_Cols
	if as_ColumnName = inv_ColAttrib[li_Cnt].is_Columns then
		// Already added, so set new values
		ilv_requestor.SetColumn(li_Cnt, as_ColumnLabel, aal_Alignment, ai_ColumnWidth)
		return li_Cnt
	end if
next

// Set the value in the data source structure
ls_Type  = ads_obj.Describe(as_ColumnName + ".coltype")
if ls_Type = "!" then return -1

li_ColCnt = UpperBound(inv_ColAttrib) + 1 
inv_ColAttrib[li_ColCnt].is_Columns = as_ColumnName
inv_ColAttrib[li_ColCnt].is_ColType = ls_Type
inv_ColAttrib[li_ColCnt].is_ColFormat = ads_obj.Describe(as_ColumnName + ".format")
if inv_ColAttrib[li_ColCnt].is_ColFormat = "?" then inv_ColAttrib[li_ColCnt].is_ColFormat = ""

// Add the column to the ListView
return ilv_requestor.AddColumn(as_ColumnLabel, aal_Alignment, ai_ColumnWidth)
end function

     
Name Owner
pfc_n_cst_lvsrv_datasource.of_RegisterReportColumn pfc_n_cst_lvsrv_datasource

     
Name Owner
listview.addcolumn listview
listview.setcolumn listview
datastore.describe datastore
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.trim systemfunctions
systemfunctions.upperbound systemfunctions

     
Full name
No Data

     
Name Scope
No Data