Tech Articles


Updating the Datawindow Object Definition


I'm doing some work on an application to aid in the mass update of various datawindow attributes. It's not rocket science since you are dealing with a series of text files and doing some basic 'find and replace' operations. However, if you have ever worked on a project which has been around for a while you will notice that datawindows do not get 'migrated' when you upgrade to a newer version of PowerBuilder; the export syntax remains at the version in which the thing was last modified and saved.

Now you might think that using the LibraryExport and LibraryImport methods will do the trick but you would be mistaken. A newly imported datawindow object keeps the same version as when it was exported.

To accomplish the task you need to use the datawindow CREATE method.

integer li_file, li
string ls_old_syntax, ls_importsyntax
// old datawindow syntax saved to a file
ls_old_syntax = 'C:\temp\d_oldstuff.txt'
// open and read the file
li_file = Fileopen(ls_old_syntax, TextMode!)
Filereadex(li_file, ls_importsyntax)
// remember to close the file
FileClose(li_file)
// check version of ls_importsyntax
IF POS(ls_importsyntax, 'release 12.5;') > 1 THEN
   // its already new, leave it alone        
ELSE
   // dw_new is object on the window
   dw_new.reset()
   dw_new.dataobject = ''
   // create the new datawindow object from the old syntax
   li = dw_new.create(ls_importsyntax, ls_err) 
   // now get the new syntax
   ls_new_syntax = dw_new.describe("DataWindow.Syntax")   
END IF

Now you can do whatever you want with the new syntax.

Comments (0)
There are no comments posted here yet

Find Articles by Tag

RibbonBar Builder Application TFS OAuth Syntax Window UI Themes SVN Transaction DataWindow JSON Charts Variable Text Array WinAPI PostgreSQL ODBC driver .NET Assembly Oracle TLS/SSL MessageBox TortoiseGit Windows OS Source Control BLOB ODBC Database ActiveX iOS Database Profile DataType Database Connection Configuration PowerBuilder (Appeon) SQL Server PBDOM Class Design Export WebBrowser Trial DragDrop DLL Bug TreeView Icon Mobile PDF PBVM Repository Menu PBNI Export JSON Database Object DevOps PowerBuilder Compiler Import Azure Graph Database Painter Data Script SDK Database Table Data PowerServer Web CI/CD XML OLE SqlExecutor SnapDevelop PostgreSQL SQL .NET Std Framework Git Debug Filter RichTextEdit Control Outlook Open Source Elevate Conference DataWindow Platform Jenkins Encoding Source Code PowerServer Mobile InfoMaker COM RibbonBar Expression RESTClient Authentication Validation Android JSON Model Visual Studio UI API File CrypterObject JSONParser SqlModelMapper JSONGenerator Automated Testing Import JSON Interface Branch & Merge PowerBuilder 32-bit UI Modernization Authorization License Web Service Proxy Debugging C# Stored Procedure REST PDFlib Deployment 64-bit NativePDF Messagging Event Handling Encryption Web API PFC Event Database Table Schema Performance Event Handler Service HTTPClient Windows 10 Icons PowerScript (PS) Sort Linux OS Error Migration .NET DataStore CoderObject IDE SOAP Resize SnapObjects OAuth 2.0 External Functions GhostScript Debugger Excel OrcaScript Testing Database Table Installation