PFC Guide Titlebar
HomeFAQLinksPFCMAGExtensionsDownloadWhat's NewSearch

Selection Service Multirow Extension

Ver. 1.00
Contributed by Boris Gasin



What

n_cst_selection

Why

Selection service allows the selection of multiple columns, but is limited to values in a single row. This extension allows the selection and return of values from multiple rows.

How

n_cst_selection, n_cst_selectionattrib and w_selection were extended to support multiple row selection. When multiple row selection is enabled w_selection will use the any returnval[] array to return the selected values from every row and every column. The two dimensional structure of values ( row / column) is flattened and returned through a single dimension array of anys. Although the array is used to return values from multiple rows and multiple columns, it can be easily parsed. The number of columns is specified upfront and of_open() function will return the total number of values returned. See the examples below.

Usage :

Prior to calling of_open() function, specify multi-row selection style:

 n_cst_selection lnv_selection
 string ls_arg[20], ls_col
 any la_values[]
 int li_selectedcount
 // Specify extended row selection
 lnv_selection.of_SetRowSelectStyle(2)
 // Open the selection Window, allowing the user to select 
 // multiple values from the cust_id column
 ls_arg[1] = "USA"
 ls_col[1] = "cust_id"
 li_selectedcount = lnv_selection.of_open("d_cust_select", la_values, &
 SQLCA, ls_col, ls_arg, "Select Customer(s)")

la_values array will contain the "cust_id" values from each row the user selects.

 

The contents of returnval[] array are shown below for a few different cases.

R1C1 R1C2 R1C3 R1C4 R1C5 R1C6 R1C7 R1C8 R1C9

 

R1C1 R2C1 R3C1 R4C1 R5C1 R6C1 R7C1 R8C1 R9C1

 

R1C1 R1C2 R1C3 R2C1 R2C2 R2C3 R3C1 R3C2 R3C3

 

Most of the times when multirow selection is used only values from a single column are needed. Parsing the array is not an issue. However, in a multi row / multi column situation the values will have to be parsed as shown below:

 n_cst_selection lnv_selection
 string ls_arg[20], ls_col[], ls_custid[], ls_custname[], ls_custstate[]
 any la_values[]
 int li_selectedcount
 // Specify extended row selection
 lnv_selection.of_SetRowSelectStyle(2)
 // Open the selection Window, allowing the user to select 
 // multiple values from the cust_id, cust_name, and cust_state columns
 ls_arg[1] = "USA"
 ls_col[1] = "cust_id"
 ls_col[2] = "cust_name"
 ls_col[3] = "cust_state"
 li_selectedcount = lnv_selection.of_open("d_cust_select", la_values, &
 SQLCA, ls_col, ls_arg, "Select Customer(s)")
 FOR li_idx = li_selectedcount TO 1 STEP -3
 	ls_custid[li_idx] = la_values[li_idx - 2]
 	ls_custname[li_idx] = la_values[li_idx - 1]
 	ls_custstate[li_idx] = la_values[li_idx - 0]
 NEXT

 


Download the About the extension contributor

 

Interested in contributing material to this web site? Send an email to submit@pfcguide.com, but don't forget to check the contribution guidelines first.


For information or suggestions about this web site please contact webmaster@pfcguide.com

PFCGuide is sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a contract or a liability against Dynamic Technology Group.

Last Revised: February 15, 2004 03:58 AM.