[Webinar] Streamline your web hosting managementRegister Today

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

LibraryImport() only works for datawindows?

Hi All,
I would like to use the LibraryExport and LibraryImport functions in a program to move objects from one PBL file to another, but Power Builder 6.5 help says that the LibraryImport function only works for datawindows.
Any ideas?
  • 5
  • 2
1 Solution
Did you try with LibraryExport() to get the syntax and type of the object and then this syntax in LibraryImport().

OR you just read the Help. Please try it first with the LibraryExport() with type of object you want and then LibraryIMport().

Best regards

Hi, PBMister.
  LibraryImport is for datawindow syntax. You need ORCA API(may be in PBORC60.DLL) to do import/export all PB objects.

more informations are here.

and you can download a free eval copy here.

sorry for above links. you have to buy that dll before accessing all import/export functions.

please let me know if don't want to buy that program.
i will develop those API for you.

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Ok, I found the solution in using ORCA API with PB.

you have to use PB6 DLL named 'PBORC60.DLL'(PB7->PBORC70.DLL,...)

here are External Functions to be used.

Function long SessionOpen () Library "PBORC60.DLL" Alias for "PBORCA_SessionOpen"
Subroutine SessionClose ( long hORCASession ) Library "PBORC60.DLL" Alias for "PBORCA_SessionClose"
Function int SessionSetLibraryList ( long hORCASession, ref string pLibNames[], int iNumberOfLibs) Library "PBORC60.DLL" Alias for "PBORCA_SessionSetLibraryList"
Function int SessionSetCurrentAppl ( long hORCASession, string lpszApplLibName, string lpszApplName ) Library "PBORC60.DLL" Alias for "PBORCA_SessionSetCurrentAppl"
Function int LibraryEntryExport ( long hORCASession, string lpszLibraryName, string lpszEntryName, long otEntryType, ref string lpszExportBuffer, long lExportBufferSize ) Library "PBORC60.DLL" Alias for "PBORCA_LibraryEntryExport"
Function int CompileEntryImport ( long hORCASession, string lpszLibraryName, string lpszEntryName, long otEntryType, string lpszComments, string lpszEntrySyntax, long lEntrySyntaxBuffSize, long pCompErrorProc, long pUserData ) Library "PBORC60.DLL" Alias for "PBORCA_CompileEntryImport"

and you need to know some constant to use with 2 functions
(CompileEntryImport, LibraryEntryExport)

for the parameter otEntryType, here values to use.

Constant long  PBORCA_APPLICATION = 0
Constant long  PBORCA_DATAWINDOW = 1      
Constant long  PBORCA_FUNCTION = 2      
Constant long  PBORCA_MENU = 3      
Constant long  PBORCA_QUERY = 4      
Constant long  PBORCA_STRUCTURE = 5      
Constant long  PBORCA_USEROBJECT = 6      
Constant long  PBORCA_WINDOW = 7
Constant long  PBORCA_PIPELINE = 8
Constant long  PBORCA_PROJECT = 9
Constant long  PBORCA_PROXYOBJECT = 10
Constant long  PBORCA_BINARY = 11

and error no to match error message after calling those functions.

Constant int PBORCA_OK             = 0 /* Operation successful */
Constant long PBORCA_INVALIDPARMS   = -1             /* Invalid parameter list */
Constant long PBORCA_DUPOPERATION   = -2             /* Duplicate operation */    
Constant long PBORCA_OBJNOTFOUND    = -3             /* Object not found */
Constant long PBORCA_BADLIBRARY     = -4             /* Bad library name */
Constant long PBORCA_LIBLISTNOTSET  = -5             /* Library list not set */
Constant long PBORCA_LIBNOTINLIST   = -6             /* Library not in lib list */
Constant long PBORCA_LIBIOERROR     = -7             /* Library I/O error */          
Constant long PBORCA_OBJEXISTS      = -8             /* Object exists */          
Constant long PBORCA_INVALIDNAME    = -9             /* Invalid name */          
Constant long PBORCA_BUFFERTOOSMALL = -10            /* Buffer size is too small */          
Constant long PBORCA_COMPERROR      = -11            /* Compile error */
Constant long PBORCA_LINKERROR      = -12            /* Link error */
Constant long PBORCA_CURRAPPLNOTSET = -13            /* Current appl not set */
Constant long PBORCA_OBJHASNOANCS   = -14            /* Object has no ancestors */          
Constant long PBORCA_OBJHASNOREFS   = -15            /* Object has no references */          
Constant long PBORCA_PBDCOUNTERROR  = -16            /* Invalid # of PBD's */          
Constant long PBORCA_PBDCREATERROR  = -17            /* PBD create error */
Constant long PBORCA_CHECKOUTERROR  = -18            /* check out/in error */

and now. here is the sample codes to import window to pbl.
(I already upload my full sample codes at

// uo_orcaapi6 is a user object
uo_orcaapi6      orca

long      ll_sid, ll_index

// 1. You need to open session before do anything, ll_sid is session handle
ll_sid = orca.SessionOpen()

string      ls_librarylist[]

// get all library that you have
for ll_index = 1 to dw_library.rowcount()
      ls_librarylist[ll_index] = dw_library.getitemString(ll_index, 1)

int      li_result

// 2. Set Library List that you have before Importion
li_result = orca.SessionSetLibraryList (ll_sid, ls_librarylist, upperbound(ls_librarylist))
if li_result = 0 then
      // 3. Set Current Application
      li_result = orca.SessionSetCurrentAppl (ll_sid, ls_librarylist[1], "a_orca_test" )
      if li_result = 0 then
            string      ls_syntax
            ls_syntax = mle_syntax.text
            string      ls_objectname
            ls_objectname = dw_list.getitemString(dw_list.getrow(), 1)
            // 4. Import your object to new PBL
            li_result = orca.CompileEntryImport (ll_sid, ls_librarylist[3], ls_objectname, orca.PBORCA_WINDOW , "comment - new object", ls_syntax, len(ls_syntax), 0, 0 )
      end if
end if

MessageBox("Result", orca.getErrorMessage(li_result))

PBMisterAuthor Commented:
This is excellent!
Your example was very helpful, without it I would have had a hard time.  I am impressed.
I looked at your site.  You have certainly fulfilled your "Mission" today.  You made this Power Builder developer be very happy.
Thank you.

I have another question.
What does uNoKSoft mean?
The name sounds like "not ok soft"
but it seems pretty OK to me.
 I am afraid that many people outthere and you think 'uNokSoft' means. :)

uNokSoft = UN + OK + Software.

here is correction.

uNokSoft = u(my name, Y(u)thasak) + Nok(my partner's name) + Soft(common word)

so, I will have to post this information in my website,too.

Yuthasak Buasuwan.

PBMisterAuthor Commented:
Thank you for explaining, I understand now.

If you get tired of explaining that to people here is another idea: SwanSoft

Thanks again.
Thank you, but I see someone use that name already. :)


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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