1. Luca Arena
  2. PowerBuilder
  3. Tuesday, 8 December 2020 23:50 PM UTC

[PB2017 R3]

Hi all,

I built an external tool to generate some PB Objects based on a simple XML specification.

My tool generates several source files (.sru, .srf and similar) ready to be imported into existing PBLs. I would like not to import them manually inside the IDE, but to build a batch file, say pbimport, and call it via command-line like:

pbimport n_myobject.sru library.pbl

so that n_myobject gets imported into library.pbl.

Is it possible/easy? I know there's OrcaScript for such operations, but I didn't find any straightforward command... seems I have to go through .pbg files and some sort of SCC commands even if my project isn't under Source Control but I couldn't find any example.

Any suggestions?

Thank you so much,
Luca

 

PS. I have bought Roland's pborcapi which could help me to do that, but I'd like to build an open source project with this generators so I'd prefer a "native" PB solution, if any.

Accepted Answer
Arnd Schmidt Accepted Answer Pending Moderation
  1. Wednesday, 9 December 2020 13:48 PM UTC
  2. PowerBuilder
  3. # Permalink

Since more than a decade there exists this little tool: pborca.exe.  (https://code.google.com/archive/p/pborca/)

It also supports import, copy, delete of objects.

You will find patches for the source on github.

But be warned, the source is good old c language.

My last compile with VS 2015 Community Edition was 3 years ago and I used PB 12.5 based PBLs without issues.

hth

Arnd

Comment
  1. Luca Arena
  2. Friday, 11 December 2020 17:57 PM UTC
Thanks again Arnd, PBORCA works like a charm! :-)



I used the last compiled version on Google Code, pborca_1.00.17.zip, and it works perfectly with PB2017 R3.

I just built a simple test.orc file like this (using a real application with 208 PBLs in the library list):



session begin pborc170.dll

set liblist begin

C:\pbapps\scorte\arca\ACMREG.PBL

C:\pbapps\scorte\arca\ACCOMU.PBL

C:\pbapps\scorte\arca\ACDDDW.PBL

C:\pbapps\scorte\arca\ACDDWI.PBL

C:\pbapps\scorte\arca\ACFUNQ.PBL

...

...

C:\pbapps\scorte\stnd\Y4LTHE.PBL

C:\pbapps\scorte\stnd\Y4LTST.PBL

C:\pbapps\scorte\stnd\Y4LVIS.PBL

C:\pbapps\scorte\pbdom170.pbd

C:\pbapps\scorte\pbsoapclient170.pbd

set liblist end

set application c:\pbapps\scorte\maga\maga.pbl, maga

import c:\tmp\work\n_convert_mmv.sru, c:\pbapps\scorte\maga\mgcomu.pbl

session end



Then I ran pborca test.orc and it imported my userobject without any issue!



Thanks again,

Luca
  1. Helpful
  1. Arnd Schmidt
  2. Friday, 11 December 2020 19:00 PM UTC
You can set the liblist from a tgt file and use external parameters and/or envrionment variables, to end up in something like:

session begin pborc170.dll

target set liblist %%TARGET%%

target set app %%TARGET%%

import %%SOURCEFILE%% , %%LIBRARY%%

session end
  1. Helpful
  1. Luca Arena
  2. Thursday, 7 January 2021 17:51 PM UTC
Very nice Arnd! I will try this way, it's much simpler :-)



Thank you so much

Luca
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 9 December 2020 02:33 AM UTC
  2. PowerBuilder
  3. # 1

Hi Luca;

  You would use the ORCA API instead. However, it's a low level "C" external call feature and not trivial to learn / use.

   I would suggest that you pick up a prebuilt "wrapper".

HTH

Regards... Chris

Comment
  1. Luca Arena
  2. Wednesday, 9 December 2020 08:26 AM UTC
Thank you Chris, in my OP I wrote: "I have bought Roland's pborcapi which could help me to do that, but I'd like to build an open source project with this generators so I'd prefer a "native" PB solution, if any".

I already own a pborcapi license but I don't know if I can use it in a open source project; I'll ask Roland! (Roland, if you're here, please tell me your opinion! :-)
  1. Helpful
There are no comments made yet.
Arthur Hefti Accepted Answer Pending Moderation
  1. Wednesday, 9 December 2020 04:51 AM UTC
  2. PowerBuilder
  3. # 2

Hi

the simplest solution would be writing a small PB application. All code could be placed in the application open event. You have the pbl and the datawindow in the commandline argument and can do FileReadEx and LibraryImport.

Regards
Arthur

Comment
  1. Miguel Leeuwe
  2. Sunday, 13 December 2020 00:05 AM UTC
Hi Chris and Luca,

Yes, this has been my feeling too for many years, hence the enhancement request I did.

It would allow us to literally generate things like template applications and 1000's of other use cases.

Someone must be still making money by not enabling this.

regards.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Sunday, 13 December 2020 00:59 AM UTC
Hi Miguel;

Armeen would have to answer that aspect.

BTW: the only reason PB Apps cannot call the ORCA API directly is that it's written in C and requires the ability to support "Call backs". Something that PB was never updated to support. I always wondered why either PS or Sybase never added that feature to PB.

Regards ... Chris
  1. Helpful
  1. Roland Smith
  2. Thursday, 7 January 2021 19:59 PM UTC
You can call the functions with callbacks from PowerBuilder, you just have to pass a zero for the function pointer.



The limitation doing that is that if the import fails, you won't have the compiler error messages.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 9 December 2020 06:47 AM UTC
  2. PowerBuilder
  3. # 3

Hi Luca,

I also don't know a OrcaScript command to import objects.

But I would try it with refresh. You can use PBGs (the old way with scc) or you use the ws_objects directory (the new way with native source control integration).

Regards,

René

Comment
  1. Miguel Leeuwe
  2. Wednesday, 6 January 2021 09:09 AM UTC
That's "completely out of the box", I love it!

regards
  1. Helpful
There are no comments made yet.
Arthur Hefti Accepted Answer Pending Moderation
  1. Friday, 25 December 2020 14:03 PM UTC
  2. PowerBuilder
  3. # 4

Hi

just in case you wan to give it a try instead of the PBOrca. I created a custom Orca project building tool quite some time ago for automatic builds. As I was in a C++ coding mood I took some functions from it and created a standalone tool to import a single user object into a PBL.

Usage: PBObjectLoader <target> <library> <source>

Where:
Target: pbt file as the libraries might be needed to compile
Library: pbl to import into
Source: Object to be imported

Errorlevel is 0 if loading works. Errors and success message are shown on the console as well.

You can download it from here: https://drive.infomaniak.com/app/share/124668/413c069f-ccbf-451a-b5fb-0cab6d3db4b0

Should work with PB 2017 and PB 2019.

Regards
Arthur

Comment
  1. Luca Arena
  2. Wednesday, 6 January 2021 08:12 AM UTC
Thank you Arthur, I will try it for sure!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.