Hi,
I have found a strange behavior of PB when I use a DataStore into a user function. If I run the projet directly from powerbuilder the function returns the info correctly, but if I run from .EXE it does not work as expected.
I prepared and attached a small project for showing the problem:
Function uf_employeecurrentdepartment
///////////////////////////
string LastDept
integer ret
DataStore ds_lastdept
ds_lastdept = CREATE DataStore
ds_lastdept.DataObject = 'dw_employeedepartmenthistory'
ds_lastdept.SetTransObject(SQLCA)
ret = ds_lastdept.Retrieve(ID)
if ret > 0 then
int li = 1
do while li <= ds_lastdept.rowcount()
// Find the employee's current dept
if IsNull(ds_lastdept.object.EndDate[li]) then
LastDept = ds_lastdept.object.department_name[li]
exit
end if
li += 1
loop
else
MessageBox('Error',string(ret)+' rows retrieved.')
end if
destroy ds_lastdept
return LastDept
////////////////////////
Environment:
PB 2019 R3 Runtime 19.2.0.2670
SQL Server 2016 Express Edition
Please, could someone help me understand where is my mistake.
I have copied the test.exe to runtime DLL folder and run it from there. The same problem!