This method was created to query the database on whether a row with a given primary key(s) value(s) exists. The function DoesTableRowExist() is available as a public function and as a method of the view object.
Syntax
1. Standalone public function:
2. Method of the Views object:
Example code for a standalone public function:
#Query the table "state" if a row with a given set of primary key values exist.
LET hm["country"]= country
LET hm["state_code"]= state_code
#FUNCTION DoesTableRowExist(table STRING, keys DYNAMIC ARRAY OF STRING, vals REFERENCE) RETURNS BOOL
IF DoesTableRowExist("state", ["country,state_code"], hm) THEN
MESSAGE "Table row with the primary key values country and state_code does exist"
ELSE
ERROR "Table row with the primary key values country and state_code does not exist"
END IF
END FUNCTION
Example code for the Views method:
#Query the table "state" if a row with a given set of primary key values exist.
LET hm["country"]= country
LET hm["state_code"]= state_code
#FUNCTION (this VIEW) DoesTableRowExist(vals REFERENCE) RETURNS BOOL
IF iForm.views["state"].DoesTableRowExist(hm) THEN
MESSAGE "Table row with the primary key values country and state_code does exist"
ELSE
ERROR "Table row with the primary key values country and state_code does not exist"
END IF
END FUNCTION