Randomizing Table Row Selection

PeopleSoft pages often contain tables, for example lists of search results. Clicking an item within such a table returns a form where the ICAction field is set to #ICRowX, where X denotes the ordinal number of the selected row.

Example: Form submitted while selecting an item in a table

dclform
  MAIN003:
    "ICType" := "" <USE_HTML_VAL> ,
    "ICElementNum" := "" <USE_HTML_VAL> ,
    "ICStateNum" := "" <USE_HTML_VAL> ,
   	"ICAction" := "#ICRow9", // hidden, changed(!)
	   "ICXPos" := "" <USE_HTML_VAL> ,
	   "ICYPos" := "" <USE_HTML_VAL> ,
	   "ICFocus" := "" <USE_HTML_VAL> ,
	   "ICChanged" := "" <USE_HTML_VAL> ,
// ...

To accurately randomize or customize such forms, you must determine the number of table rows.

There are four functions that assist with this:
  • GetMaxRowNr returns the maximum valid row number (for example in a table with 47 rows the maximum valid row number is 46, since row numbers are zero-based). If the current page does not contain a table, it returns -1.
  • GetRowCount returns the number of rows on the current page. If the current page does not contain a table, it returns 0.
  • GetRndRowStr returns a valid, random row string.
  • FindICRow(sStringToFind : string) : string returns the row string of the first row that contains the given text.

In the example below the GetRndRowStr function is used to randomize the selection of an item in a table.

Example: Randomizing the selection of an item in a table

dclform
  MAIN003:
// ..
    "ICStateNum" := "" <USE_HTML_VAL> ,
    "ICAction" := GetRndRowStr(),
    "ICXPos" := "" <USE_HTML_VAL> ,
// ...