NAV 2013 Active Session

nboettcher
Member Posts: 14
I am trying to use the Active Session table from C/AL Code in NAV 2013.
I am doing the following:
ActiveSession.SETRANGE("Session ID", SESSIONID);
ActiveSession.FINDFIRST;
ServerName :=ActiveSession."Client Computer Name";
However, when that code is executed I get the following error:
"There is no Active Session within the filter. Filters: Session ID: 1"
If I look in SQL at the Active Session table, there aren't any entries. I have restarted the NAV Service multiple times.
Any ideas?
I am doing the following:
ActiveSession.SETRANGE("Session ID", SESSIONID);
ActiveSession.FINDFIRST;
ServerName :=ActiveSession."Client Computer Name";
However, when that code is executed I get the following error:
"There is no Active Session within the filter. Filters: Session ID: 1"
If I look in SQL at the Active Session table, there aren't any entries. I have restarted the NAV Service multiple times.
Any ideas?
0
Comments
-
Hi,
The problem here is that you are forcing your session id filter to 1. Even if there are more that 1 session actually connected they might not be on session id 1. Where do you get this value from ?0 -
I have some problems understanding why there is not always an active connection on the connection one is on. But the answer of gideon looks a bit odd, since the SESSIONID is a rather undocumented DATABASE variable. (I've looked in the help for SESSIONID, it's not there, even though it is a valid DATABASE variable)
So this question remains, because I get this error when calling similar functionality in a SOAP session.0 -
What do you want to achieve? The client has no database connection, only the service-tier has one.
As far as I know, the SESSIONID is deprecated and also the virtual table session is gone.
If you want to get the host name of the client you might need to use an automation/.net that runs on the client, like described here: http://www.dynamics.is/?p=282.0 -
SiSt wrote:What do you want to achieve? The client has no database connection, only the service-tier has one.
As far as I know, the SESSIONID is deprecated and also the virtual table session is gone.
If you want to get the host name of the client you might need to use an automation/.net that runs on the client, like described here: http://www.dynamics.is/?p=282.
I'm working with soap calls. and I require the database name. But regardless that it's always the same name for one instance, I must have it for the current session.
If SessionID is depreciated, I would greatly appreciate if you could point me to documentation about that.0 -
The session table is documented for NAV2009 (http://msdn.microsoft.com/en-us/library/dd338636.aspx) but it isn't for 2013, which let me believe that they do not support it any longer.
But I guess I was wrong, as they are some people using it with 2013.
But I guess there is a simpler way, at least in 2013R2 exists a virtual table Database (ID 2000000048), you can try to filter it for "My Database" = true. And read out the name of the Database.0 -
hey,
Looks like I have similar problem. Guys, can I search for any ActiveSession usage with C/SIDE?
I am absolutely unfamiliar with NAV, help please.
If I understood correctly all NAV code is in codeUnits, but I can't understand what invokes them.0 -
solved
OnAfterGetRecord trigger of Company Information page runs following code when System Indicator is "Company + Database" :ActiveSession.SETRANGE("Session ID",SESSIONID); ActiveSession.FINDFIRST;
The code causes the error.
At Company Information page edit form I've changed System Indicator field value from "Company + Database" to "Company".0 -
@Anatoliy_E
Agreed, that's a good solution. I have done this too. In the past if I ever needed the DB name in C/AL, I'd just add it as a new text field to Company Info. Don't know if there's a better solution.Regards,
Vincent Connell0 -
it can be that the records in table active session where removed.
so, close the windows client, restart it.
then try again.best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions