• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1398
  • Last Modified:

ORCA Powerbuilder import

Hai all,

I would like to develop an application to export powerbuilder objects from pbl to text
file and import back to powerbuilder pbl , power builder support export library built in function to export but importing is not available. i tried ORCA but its always gives errors
could any one give me a sample code to import

  • 3
1 Solution
Which version of PowerBuilder are you using for this? I assume you want something that will do this in an automated fashion rather than using the PowerBuilder IDE to do it, since the IDE is a manual process that you can only do 1 PBL at a time (you can export and import multiple objects at a time, but not objects in multiple PBL files at the same time).

However, PowerBuilder 11.5 (and possibly earlier versions) supports built in functions to do what you want to do in an automated process. You can look in your PB reference or look in the help for the "Library*" family of PowerScript methods.

For example, You can use this to export:

String ls_obj_syntax, ls_errors

ls_obj_syntax = LibraryExport("c:\somefolder\Source.pbl", "w_someobject", exportWindow!)  

Open in new window

Note that the last argument is a constant that tells what the object type is, here are the supported object types you can export:

ExportApplication! - Application object
ExportDataWindow! - DataWindow object
ExportFunction! - Function object
ExportMenu! - Menu object
ExportPipeline! - Pipeline objects
ExportProject! - Project objects
ExportQuery! - Query objects
ExportStructure! - Structure object
ExportUserObject! - User objects
ExportWindow! - Window object

And now you  have  a string that contains the PowerScript code of the object, so you can use file i/o methods to write it to a text file at this point.

You can import to a PBL as well:

string dwsyntax, ErrorBuffer
integer rtncode

dwsyntax = "Some Datawindow Code I read from a file"

rtncode = LibraryImport("c:\somefolder\Target.pbl", "dw_datawindow", ImportDataWindow!,  dwsyntax, ErrorBuffer, "The Object Comments Added to the PBL")

Open in new window

There are also other library methods you may find useful:

LibraryCreate - make a PBL
LibraryDelete - delete a PBL or can be used to delete a dw from a PBL (only datawindows)
LibraryDirectory - lists all the objects in a PBL of a specific object type

Hope this helps.
Just thought I would add another possible suggestion. You can also use an MSSCCI compliant  source control system, such as Team Foundation Server, to do what you want also, with the PowerBuilder IDE, at least with 11.5.

You would make your application's Workspace have source control pointing to the MSSCCI provider, and then tell to keep the objects on disc. Then You would right click the target I think, and tell it to put all objects in source control, which will go through every PBL and export all of the objects to text files and imports them to the source control provider. Then you can also check out all the objects at once. Now go to the source control folder where it saves your local copies and make whatever changes you need to make, and check in with the source control. Then "get latest" from PB and it will import the new code to the PBL.

It might help us offer more suggestions if we knew what the reason you were trying to do this was, there may be other solutions that are easier.
One last suggestion. :)

If you're just trying to do this one time for one big project, and won't be doing it over and over again on an ongoing basis, you can do this.

First, make a separate folder under your main application's source folder for each PBL file and put the PBL in that folder.

So Instead of C:\MySource\ having 15 PBL files, your library list will look more like this:


Then you can go to each PBL 1 time each and highlight all objects and export to the folder where the PBL is in.

Then you can make whatever changes you want to make to the files.

Then you can again go into PB and right click on each PBL 1 time and then highlight all the files again for that folder and import them at once.

So if you have more than about 40 PBL this could be a pain, or if you have to do this frequently, also a pain, but if this is just for one time thing or seldom, this is easier than trying to write an app to do it or setting up source control with MSSCCI or whatever.
Vadim RappCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now