- Berka Frenfert
- PowerBuilder
- Wednesday, 3 August 2022 02:33 PM UTC
I remember i did this long ago and it worked (in PB version 10 probably).
I export syntax of an external datawindow then add some data in it and Imported it back into either dll or pbd depending build type.
the "data(" is searched from the exported external dw syntax. then i add at the end of the line new comma separated data. Creating syntax and importing it in library (dll or pbd) is not the problem.
The Problem:
The new last row i added in script at runtime, instead of increasing rowcount, somehow updates any one of the previous rows.
I could not understand this behavior.
But same code when used without creating project and run in Powerbuilder IDE 12.5 the new row is added in previous rows and rowcount increases. It only happens when export and import both are from pbl and app runs in IDE.
dwsyntax = LibraryExport(GetCurrentDirectory() + "\btserverdll.pbl", "dwe_list", ExportDataWindow!)
IF IsNull(dwsyntax) OR TRIM(dwsyntax) = "" THEN
MSG.Text = "LibraryExport failed."
RETURN
END IF
TheLine = Pos( dwSyntax, "data(")
TheLineEnd = Pos( dwSyntax, ",)", TheLine)
IF TheLineEnd > TheLine THEN
TheLineEnd = Pos( dwSyntax, ",)", TheLine)
dwSyntax = Replace(dwSyntax, TheLineEnd, 2, + "," + Trim(NewRow )+ ")")
ELSE
IF TheLineEnd <= TheLine THEN
TheLineEnd = Pos( dwSyntax, ", )", TheLine)
dwSyntax = Replace(dwSyntax, TheLineEnd, 3, + "," + Trim(newRow )+ ")")
END IF
END IF
rtncode = LibraryImport( GetCurrentDirectory() + "\btserverdll.dll", "dwe_list", ImportDataWindow!, dwsyntax, ErrorBuffer,"dynamic @ runtime")
IF rtncode <> 1 THEN
///MessageBox("LibraryImport ERROR", ErrorBuffer)
ELSE
dw_1.DataObject = "dwe_list"
END IF
Please note that i carefully checked the export and import is from dll in case of machine code and pbd in pcode. In the above code export is from pbl which i was just testing.
Even after trying all possible combinations i could not get new row added in neither dll nor the pbd.
Is it not possible in PB12.5.
What i am trying to do is that. two application server and client talk to each other on winsock. client sends new row to server side and server keeps list of the rows. Server export the external dw add data in it syntax and import it back. this idea is working only through PB IDE. But when exe runs behavior is different.
I am pretty much sure i have done this through exe long ago. May be forgetting but i need to do it now. Please help because 2 days of effort made my write this request.
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.