Description
Use IsahRecordpointers object to read or set the current record pointer of a table within a script. This can be particularly useful when you want to set default values in selection fields based on the record pointer. This would primarily concern reports. For example, in the case of invoices, the number of the last invoice opened can be entered as the invoice number by default.
Example
sub Main()
	rem Reads the record pointer of the customer table
	msgBox IsahRecordpointers.RecordPointerValue("customer","custid")
	rem Sets the record pointer of the customer table
	IsahRecordpointers.RecordPointerValue("customer","custid") = "00000"
	rem Reads the record pointer of the customer table
	rem Notice it has changed
	
	msgBox IsahRecordpointers.RecordPointerValue("customer","custid")
end sub
function getDefaultValue()
	getDefaultValue = IsahRecordpointers.RecordPointerValue("customer","custid")
end function
IsahRecordpointers and Reports
If you want to use the IsahRecordpointers object to enter a default value as the report selection, you should use the getDefaultValue function within that report selection script. A report containing the report selection method 'From customer' and 'To customer' could have the following report selection script:
function getDefaultValue()
	getDefaultValue = IsahRecordpointers.RecordPointerValue("customer","custid")
end function
IsahRecordpointers and Presets
If you want to use the IsahRecordpointers object to enter a default value as a preset parameter, you should use the getDefaultValue function within that recordpointer script.
function getDefaultValue()
rem This procedure returns the customer ID of the sales record that was last
rem viewed by the user concerned.
rem If no value can be found this function will return an emty string.
if IsahRecordpointers.RecordPointerValue("DossierMain","DossierCode") <> "" then
Dim Query
Dim SQL
SQL = " SELECT CustId" &_
" FROM T_DossierMain " &_
" WHEREDossierCode = """ & IsahRecordpointers.RecordPointerValue("DossierMain","DossierCode") & """"
Set Query = Application.DataBase.CreateQuery( SQL )
Query.Open
getDefaultValue = Query("CustId")
Query.Close
else
getDefaultValue = ""
end if
end function
In this folder |