1. Håvard Heide
  2. PowerServer
  3. Tuesday, 4 January 2022 09:21 AM UTC

Is it possible to check in Powerscript if code is running in Powerserver or as a PB application.

Standard PB application reads/write to local disk - when it is deployed those files are placed in different folder.

Is there a function or a status to access that will identify if the application is running deployed or standalone ?

Thanks

Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 4 January 2022 15:03 PM UTC
  2. PowerServer
  3. # 1
Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 4 January 2022 15:00 PM UTC
  2. PowerServer
  3. # 2

Here's how I do this:


// Local External Function

// OKnight, 24-MAY-2006.  Migrated to PB v10.5.
FUNCTION Ulong GetModuleFileNameW ( Ulong Handle, Ref String ExePath, Ulong Size ) LIBRARY "kernel32.dll"


// corp_n_cst_appmanager.ue_post_logon()
// ---------------------------------------------------------
String        ls_toolbartext, ls_executableFullPath

// Initalize
ll_size = 200
setNull(ll_handle)
ls_executableFullPath = Space(ll_size)

// Get the full path to this current executable
ll_RC = GetModuleFileNameW ( ll_handle, ls_executableFullPath, ll_size )
ll_length = Len ( ls_executableFullPath) -  LastPos ( ls_executableFullPath, '\' )
is_executableName = Lower ( Right ( ls_executableFullPath, ll_length ) )

// At this point if I'm running from the IDE the is_executableName = 'pb190.exe'

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 4 January 2022 13:24 PM UTC
  2. PowerServer
  3. # 3

PB2021/PS2021 does have a built in powerscript function for that. 

 

Earlier versions do not, you can create your own function and have 2 version of it.  The PS version you deploy only in PS only pbl that is listed in front of all other pbls:

 

C/S version:

global type f_ispowerserver from function_object
end type

forward prototypes
global function boolean f_ispowerserver ()
end prototypes

global function boolean f_ispowerserver ();RETURN FALSE
end function

 

powerserver version:

global type f_ispowerserver from function_object
end type

forward prototypes
global function boolean f_ispowerserver ()
end prototypes

global function boolean f_ispowerserver ();RETURN TRUE
end function

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 4 January 2022 09:48 AM UTC
  2. PowerServer
  3. # 4

Have you tried function IsPBApp? I don't know what it returns with PowerServer.

In PB2021 there is also a function IsPowerServerApp!

 

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 4 January 2022 15:51 PM UTC
IsPBApp() tells you if you are running traditional client/server or not. But it won't confirm if it is definitely PowerServer... you just know it is not traditional client/server. To confirm if running as PowerServer, should use the IsPowerServerApp().
  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.