1. Edyth Paul
  2. PowerBuilder
  3. Tuesday, 1 December 2020 22:36 PM UTC

I was wondering if anyone has used PowerBuilder (Powerscript) to make calls to the R statistical package.  I have a user that would like a nice front-end GUI to sit on top of some custom R libraries they have written.  I'm not sure if/how this can be done using Powerscript.  Any suggestions, examples or advice would be very welcome.

Thanks,

Edie

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 2 December 2020 16:14 PM UTC
  2. PowerBuilder
  3. # 1

Hi Edyth;

  FYI:  https://www.dataquest.io/blog/r-api-tutorial/

HTH

Regards .... Chris

Comment
There are no comments made yet.
Edyth Paul Accepted Answer Pending Moderation
  1. Wednesday, 2 December 2020 20:01 PM UTC
  2. PowerBuilder
  3. # 2

Hi Chris,

Thanks for the link.  I think, however, I need to do the reverse of what is shown in the tutorial.  I need to use Powerscript to make calls to R libraries (not use R to make calls to Powerbuilder).  I don't believe that R has an API.  I think I can make calls to R using C# but I'm not very familiar (at all) with C#.  For example, from a Powerbuilder menu or button event I need to call some R routines.  Is it possible to use C# code in one of those events, intermingled somehow with Powerscript?  Sorry if this is a totally ignorant question.

Edie

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 2 December 2020 20:07 PM UTC
If you can make calls to R using C#, then you could create a C# wrapper DLL and then import that C# DLL into PowerBuilder using .NET DLL Importer so you can call that DLL from PowerScript. Here is video about the .NET DLL Importer: https://www.appeon.com/developers/library/videos/net-assembly-importer.html
  1. Helpful
There are no comments made yet.
Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Thursday, 3 December 2020 19:25 PM UTC
  2. PowerBuilder
  3. # 3

Hi Edith,

 

I think that there are several ways in which you can accomplish this. You can either try to call it using a C# wrapper as Armeen mentioned or you can also do it through a RESTful Web API call using the PowerScript's RESTClient object. But of course, both solutions require some additional code on the C# or R side of things.

 

So you might want to check which of the two options is best for you. Following you may find info on how to consume your R library with C#: https://www.codeproject.com/Articles/25819/The-R-Statistical-Language-and-C-NET-Foundations and you may find how you can convert your R project into a RESTFul Web API using R Plumber here: https://www.r-bloggers.com/2020/01/how-to-create-rest-apis-with-r-plumber/

 

Hope this helps. But if you need more help on how to consume the C# dll or the RESTful Web API, please do let us know.

 

 

Regards,

Comment
There are no comments made yet.
Edyth Paul Accepted Answer Pending Moderation
  1. Friday, 4 December 2020 19:40 PM UTC
  2. PowerBuilder
  3. # 4

Thanks to all the suggestions and links.  I'll check these out and see what might work best.  I think I'd prefer converting the R code to a RESTful API, but that will depend on the user's cooperation.  Thanks again!  -Edie

Comment
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.