on.main.table()

Syntax
void on.main.table( function_name [, ...] )

Description
This copies the contents current record of the main table to the record buffer of that table, saves the record, and executes the specified function. After that the saved record buffer is restored. This enables you to perform actions on the record contents without affecting the values in the table.

Arguments
function_name The name of the function that must be executed. The function must be of type void.
. . .                         Use these optional arguments to pass one or more arguments to the function.

Context
4GL library function
You can use this function only in 4GL scripts. You cannot use it in the before.program section because the main table has not yet been defined at this point. The function is not relevant to programs of type 4.

Example
| Suppose you have a table to which you can add numbers only
| if a certain value is present in the main table


declaration:
long go_ahead


field.pctst999.number:
check.input:
on.main.table( check_number, 5 )
if not go_ahead then
set.input.error("pctst0003", 5)    |"Number %d not present"
endif


functions:
function void check_number( long number )
{
select pctst999.*
from pctst999
where pctst999.number = :number
as set with 1 rows


selectdo
go_ahead = TRUE
selectempty
go_ahead = FALSE
endselect
return


}


Related Post:

People who read this post also read :



0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More