- Marcos Bolonha
- PowerBuilder
- Wednesday, 10 March 2021 04:03 PM UTC
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.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.