1. Rajkumar K S
  2. PowerBuilder
  3. Friday, 19 May 2023 16:55 PM UTC

Hi Team,

Good day!

Recently we have configured and successfully installed our application to power client. In our system we have dynamically creating datawindow object and saving it into one of our saved pbd by using libraryimport command. This is successfully working in normal exe and datawindow object is created without any issues ( without using the powerclient ). But when we use the powerclient downloaded exe, it is crashing the exe without throwing any error while calling the LibraryImport command. 

Please help us to resolve this issue. 

Regards

Rajkumar K S

Csquare Solutions

 

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Saturday, 20 May 2023 02:48 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Rajkumar ;

    Yes, this is absolutely possible. In fact, I just created a Test Case in the new PB 2022 R2 beta (just for fun)!  ;-)

Both PC and PS Apps have a different architecture - so you need to think outside of the box a bit. Both PC & PS deployments send your PBLs to the Web Server as Folders and compressed PB Classes as ZIP files. Here is my LibraryImport Test Case deployment ...

WorkSpace

IIS

PC App Executing ...

Trick #1 --- you need a blank PBL that is not in the Apps library list

Trick #2 - Deploy the PBL and the DWO syntax as external files in the PC/PS App project

Trick #3 - At runtime, add the "real" PBL to your PC/PS App's library list

Long        ll_bytes
ll_bytes    =    AddToLibraryList ( "library_import2.pbl" )

Trick #4 - dynamically add the DWO source to the dynamic PBL

String		ls_dw_source
String		ls_errors
Int		li_rc
Int		li_filenum
Long		ll_bytes

li_FileNum = FileOpen ("dw_Library_Import.txt", TextMode! )
ll_bytes   = FileReadEx ( li_filenum, ls_dw_source )
MessageBox (" DWO Read", String ( ll_bytes ) )
li_rc	   = LibraryImport ( "Library_Import2.pbl", "dw_Library_Import", ImportDataWindow!, ls_dw_source, ls_errors, "L.I. test" )
MessageBox (" Library Import", String ( li_rc ) )
dc_data.dataobject = "dw_Library_Import"
dc_data.SetTransObject ( SQLCA)
dc_Data.Retrieve ( ) 
  1. After the DWO source is read, the LibraryImport can now be done in the 2nd "real" PBL.
  2. Once that 2nd PBL has the DWO, you can then assign the DWO to the DC. This works as the LibraryImport has worked.
  3. Now you can assign SQLCA to the DC and the DWO can be located in the secondary PBL which is now in the library list.
  4. Then you can perform any Retrieve, Update, Sort, Filter, etc commands against the DC as we have a real DWO in play.  :-)

So the PC/PS app now works great with the LibraryImport command if you follow my approach!   (Chris's weird way of doing things with PB - LOL!)

HTH

Regards ... Chris

 

 

Comment
  1. mike S
  2. Tuesday, 23 May 2023 01:02 AM UTC
@ Chris P - so are you saying that the AddToLibraryList / SetLibrary list works with powerServer too?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 23 May 2023 01:29 AM UTC
Hi Mike;

I haven't tested the Setlibrarylist command yet but, I think it should work with both PC & PS Apps. The AddToLibraryList() works for PS App's as well as PS uses PC for the App delivery & execution. ;-)

Regards ... Chris
  1. Helpful
  1. Roland Smith
  2. Thursday, 25 May 2023 15:19 PM UTC
I would think that allowing LibraryImport to work with all object types would require deployment of several DLL files that are currently part of the IDE.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 24 May 2023 18:03 PM UTC
  2. PowerBuilder
  3. # 1

Hi Everyone;

  Just an update on the LibraryImport() command in relation to PowerServer projects.

Note that my workaround for PowerClient will fail at runtime for PS Apps, as follows:

  That is because the App has no DWO's at compile time and thus, the PS Server has no Web API's generated for those DWO's. As you can see from the PS Test above, this would be the runtime error.

Also note that PS Apps built this way using the SelectBlob approach for the DWO's dynamically would also fail this way as well as Mike suggested!  :-(

So for now, my solution / workaround is only good for PowerClient Apps

Regards ... Chris

 

 

Comment
  1. mike S
  2. Wednesday, 24 May 2023 20:54 PM UTC
I get that any embedded sql will fail, and any datawindow in a pbl will fail; it makes sense that it does based on how it all works by generating c# webapi calls.



However, are you saying that you can get powerscript to run from a PBD in powerserver by using AddToLibraryList/libaryimport? That is something, and might be very useful.
  1. Helpful
  1. mike S
  2. Thursday, 25 May 2023 14:55 PM UTC
@chris, also remember that datawindows loaded from syntax in powerserver MUST use sql syntax and not graphical. I know you like to use graphical over syntax, but that will not work in PS.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 25 May 2023 17:46 PM UTC
Nope .. tested that & they all fail as there is NO Web API's built for these if the PS Compile does not see these!!!!!!!
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 23 May 2023 00:57 AM UTC
  2. PowerBuilder
  3. # 2

another option would be to skip the pbd import.

save the datawindow (dwo) syntax to the database, or a text file that gets downloaded with your app.  then at runtime read that into a string that is used to create the datawindow.

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 19 May 2023 21:39 PM UTC
  2. PowerBuilder
  3. # 3

LibraryImport is unsupported feature when deploying as PowerClient or PowerServer project types.  If you must use this in your app then you can only do traditional client/server compile.

Comment
  1. Rajkumar K S
  2. Saturday, 20 May 2023 02:36 AM UTC
Hi,

Thanks,

Is there any alternative solution to create data window in existing pbd using powerclient build.



Regards

Rajkumar K S
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Saturday, 20 May 2023 13:56 PM UTC
Please take a look at what Chris Pollach suggested.
  1. Helpful 1
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.