NetTalk Central

Author Topic: Method to detect debug mode  (Read 3224 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Method to detect debug mode
« on: July 22, 2015, 09:52:12 AM »
Hi,

Is there a NetTalk method or property to detect whether the app is in release or debug mode?   I want to display GUID's in forms and browses during maintenance.  It is super easy to do a custom method to get it,  but figure if it is already in NT why not use it.

Thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Method to detect debug mode
« Reply #1 on: July 22, 2015, 10:29:50 PM »
Hi Casey,

let me break your question into 2 parts;

>> a) can you optionally include fields on browses and forms.

Yes. I'd use a session value myself (so this could be "per user") but you could also use a simple global variable (but then it would affect all users.) Browses and forms both include an
"Include"
type setting. So for example;

p_web.GSV('debugmode') = 1

would allow you to see the guids when that session value is set.

>> b) What's the best way to set the value?

You could make it depend on debug or release mode like this (in WebHandler, ProcessLink method, before parent call)

?   p_web.SSV('debugmode',1)

Lines with a ? at the front are only compiled in debug mode.

But this would affect all users, and would prevent you shipping in debug mode (which you will almost certainly want to do at some point) so I wouldn't do it like this. I'd do something like

if p_web.IfExistsValue('_secretWayToTurnOnDebugging_')
  p_web.SSV('debugmode',1) 
end


The you can add the switch to any URL to turn on debugging for just that user;

http://127.0.0.1:88?_secretWayToTurnOnDebugging_=1

Cheers
Bruce



CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Method to detect debug mode
« Reply #2 on: July 23, 2015, 08:43:43 AM »
Thanks, Bruce

? was how I was thinking about doing it, but I hadn't thought of deliberately shipping in debug mode.