Options

Job Queue for Unlimited Company

13

Comments

  • Options
    william_uwilliam_u Member Posts: 4
    Hi ara3n,

    Great solution. Works fine with SQL version.

    Has anyone got this working for native version?
    I have tried to get it working for native version, by modifying trigger RunNasForOtherCompany in Codeunit 50000 Run NAS Accross Company as follows:
    ...
    //Server variable does not exist
    //Server.SETRANGE("My Server",TRUE);
    //Server.FINDFIRST;
    .....
    //txtCommand := 'NASSQL servername=' + Server."Server Name" + ','+
    txtCommand := 'NAS servername=' + 'SERVER01' + ','+
    'company=' + JobQueueEntry."Company Name" + ','+
    'nettype=TCP,startupparameter=' + 'JOBQUEUE2|'+COMPANYNAME+'|'+FORMAT(JobQueueEntry.ID);
    ...

    Unfortunately, this does not work; the second NAS session is not created.
    Running this code in command prompt did not give a result either, as the JobQueueEntry.ID does not exist.

    Anyone have an idea?
  • Options
    ara3nara3n Member Posts: 9,255
    change JobQueueEntry.ID to the PK of a JobQueueEntry Card.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    william_uwilliam_u Member Posts: 4
    Hi ara3n,
    Thank you for your help.

    I have tried these 2 options:
    ....
    'nettype=TCP,startupparameter=' + 'JOBQUEUE2|'+COMPANYNAME+'|'+FORMAT('{60BC78D8-DE83-42F4-B872-999D663DF62B}');
    OR
    'nettype=TCP,startupparameter=' + 'JOBQUEUE2|'+COMPANYNAME+'|'+'{60BC78D8-DE83-42F4-B872-999D663DF62B}';

    but the 2nd NAS session is never made; cu50000 is not run; I have put several messages in codunit 1 and codeunit 50000, but they are not called.
    Other options?

    Best regards,
    William
  • Options
    ara3nara3n Member Posts: 9,255
    Can you try and start nas from command prompt with just jobqueue parameter?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    william_uwilliam_u Member Posts: 4
    Hi ara3n,

    I just got it working.

    I have put the following in cmd prompt:
    NAS servername=XBI-LAP106, company="CRONUS Nederland BV",nettype=TCP,startupparameter="JOBQUEUE2|"CRONUS Nederland BV"|"{60BC78D8-DE83-42F4-B872-999D663DF62B}"

    Then I got the message that an EXIT was done in CU 50000:
    ....
    IF NOT Company.GET(txtFromCompany) THEN BEGIN
    MESSAGE(txtFromCompany);
    EXIT;
    END;
    ....
    which means that company "CRONUS Nederland BV" does not exist.
    I have changed the companyname to UPPERCASE "CRONUS NEDERLAND BV" and it works.

    How to solve uppercase problem?
    In Codeunit 1, the parameter is converted to uppercase.
    ParamStr := UPPERCASE(NASID);

    Then it is passed to codeunit 50000, as uppercase
    CU50000.SetParameter(Parameter);

    Then in codunit 50000 OnRun, the uppercase company is never found, and exit is called
    IF NOT Company.GET(txtFromCompany) THEN BEGIN
    MESSAGE(txtFromCompany);
    EXIT;
    END;

    I have modified codunit 1 to get it working with lowercase:
    //MOD01 Start
    IF (COPYSTR(Parameter,1,9) = 'JOBQUEUE2') THEN BEGIN
    //CU50000.SetParameter(Parameter);
    CU50000.SetParameter(NASID);
    CU50000.RUN;
    CGNASStartedinLoop := TRUE;
    END;
    //MOD01 End

    This works fine.
    Thank you very much.

    Best regards,
    William
  • Options
    ara3nara3n Member Posts: 9,255
    That's great that you got it solved.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    william_uwilliam_u Member Posts: 4
    Hi ara3n,

    Have you tried second NAS for running (complex) reports?
    Or did you only test codeunits?

    We noticed that the second NAS cannot run reports with multiple indent, like for example:
    Job
    ...Job Ledger Entry

    Simple reports without indent work well with second NAS (for example adding an Item in table 27).

    It is not clear why.
    Do you have any idea?

    Best regards,
    William
  • Options
    ara3nara3n Member Posts: 9,255
    That is odd. Try to run it from cprompt as before do you get the same results?

    Are you specifying some specific printer? Do you get the same result on on NASSQL as on native?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    sandy_bsilsandy_bsil Member Posts: 40
    Hi All,

    I am getting confused..

    1. I have installed NAS.
    2. I have 12+1 [one dummy company] companies.. data for all 12+1 companies will be available in one table in NAV. I have to move them to the respective company's General Journal. I have few [based on Transaction Type] reports to do the same. Now i need to schedule the same on NAS.

    3. I have imported the above customized objects. But getting confused with the setup.
    a) In which company I have to do the Job Queue Setup.
    b) In the Job Queue Entries, which object to run.. my customized reports or the CU 448??
    c) What about the Job Queue in the other companies??

    What i did..
    1. After installing NAS, imported the customized Job Queue objects.
    2. In the dummy company i created one Job Queue Entry to run a customized 50001 report and the company i selected was Company1.
    3. In the Event Viewer i am getting an error

    The value of COPYSTR parameter 3 is outside of the permitted range.

    The current value is: -1.
    The permitted range is: from 0 to 2147483647

    I saw that in the Codeunit 50000 [Run NAS Accross Company], the
    txtFromCompany := COPYSTR(strParamemter,1,STRPOS(strParamemter,'|')-1);
    is returning this error..

    So please let me know, whats the mistake i am doing.. ](*,)

    Thanx in advance..
    Sandeep B
  • Options
    snehasneha Member Posts: 191
    We are using Native 5.0 SP1. I have downloaded and imported the objects into the database from the given link. I tried to compile the codeunit 50000. I am getting the error message “Table data 2000000047 doesn’t exist”. I think the virtual table number 2000000047 works for SQL server. Could you please tell me what should I use the table number for Server in Native?

    Thank you for your help!


    Job Queue for Unlimited Company
    The Job Scheduler 4.0 has been replaced in in 5.0 by Job Queue. You can use Job Queue to schedule to run reports, Codeunits, as adjust cost. Job Queue uses NAS to run the job. As you might know NAS can only run for one company. Thus if you have multiple companies, you need one instance of NAS per Company. The following modification allows you to run Job Queue in unlimited companies. Using two license instances of NAS. You only need to install one NAS. The code run NAS itself as second instance connecting to different companies. The only difference Setup wise is the new field "Company Name" in Job Queue Entry Code, where you can select other Companies.

    You could run with one instance of NAS and a Navision client, by running CU 448 directly from a client where NAS is installed. NAS service should be stopped. NAS uses windows authentication so make sure have windows authentication.

    Feedback is welcome.
    Enjoy.

    http://www.mibuso.com/dlinfo.asp?FileID=924

    Discuss this download here.
  • Options
    ara3nara3n Member Posts: 9,255
    that table is the server table. I just need to know what the server name is. You can have it as a setup or get it from wherever NAV classic gets it in file->datbase->information
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    Hi,

    My requirements are something like that. Client has multiple companies with 2 NAS license. Now I want one NAS will call Master Company and thru Job scheduler and other NAS will call all other companies one by one. Like Job scheduler will call one company, process the code kill the session and call 2nd company and like that.

    I gone thru the code design for multiple companies but I am not sure if this will solve my problem. I cannot see anywhere in the code where its looping all the company one by one. Please let me know if I understand wrong.

    Your help and quick response will be highly appreciated.

    Regards
    Mini
  • Options
    ara3nara3n Member Posts: 9,255
    There is a new field on Job Queue Entry table called Company Name and the job would run for that company.

    If you have multiple companies, you would create one job queue entry for each company.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    Hi,

    Thanks for prompt reply. But I am little confused. Did you meant that in each company, define a compnay name in new field "Company Name", in Job Queue entry card?

    If yes then how the NAS will switch one compant from other since only 2nd instance of NAS will run per company. Do I need to schedule different time for diffrent company to run the Job queue or the system will smart enoghu if process one by one company.

    Please advice.

    Regards
    Mini
  • Options
    ara3nara3n Member Posts: 9,255
    you will setup the job queue in one company only. For each job queue entry record in that one company you can specify in which company that object will run I just looked at my blog and it looks like the company name is specified in

    So one NAS will look only in one company. and will call the second NAS based on Job queue entry card new field company name.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    I have the same issue as sandy_bsil have.
    Event Type: Warning
    Event Source: GGHAPP01-SQL
    Event Category: None
    Event ID: 20010
    Date: 8/24/2010
    Time: 3:24:28 PM
    User: N/A
    Computer: GGHAPP01
    Description:
    The value of COPYSTR parameter 3 is outside of the permitted range.

    The current value is: -1.
    The permitted range is: from 0 to 2147483647.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    This error message is comming due the code written in CU50000

    txtFromCompany := COPYSTR(strParamemter,1,STRPOS(strParamemter,'|')-1);

    strParameter = JOBQUEUE2

    Please advice.
  • Options
    ara3nara3n Member Posts: 9,255
    I guess there is a problem with how the Parameter is being passed to the CU when NAS starts. Put a breakpoint and solve it.

    //MOD01 Start
    IF (COPYSTR(Parameter,1,9) = 'JOBQUEUE2') THEN BEGIN
    CU50000.SetParameter(Parameter);
    CU50000.RUN;
    CGNASStartedinLoop := TRUE;
    END;
    //MOD01 End
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    I have a qurey regarding NAS license. My company bought 1 more NAS license so total 2 new sessions. I amk geeting the error message :
    Event Type: Warning
    Event Source: GGHAPP01-SQL
    Event Category: None
    Event ID: 20010
    Date: 8/25/2010
    Time: 4:18:26 PM
    User: N/A
    Computer: GGHAPP01
    Description:
    Your program license does not permit more users to work simultaneously.

    Wait until another user has stopped using the program.

    Contact your system administrator if you want to allow more simultaneous users on your system.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    Is that mean, somehow 2nd NAS session is not existing in license? If I can see the License granules it shows that:

    1415 - Application Server Each 1

    Is that mean License has 2nd NAS session or just one seesion come by default?
    If this is 2nd NAS session license then why I ma getting the above error message?

    Regards
    Mini
  • Options
    ara3nara3n Member Posts: 9,255
    Did you upload the license on sql server?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    I uploaded the license under C:\Program Files\Microsoft Dynamics NAV\60\Classic(SQL Server) and C:\Program Files\Microsoft Dynamics NAV\60\Application Server (Application server). Do i need to upload the license any other place?
  • Options
    ara3nara3n Member Posts: 9,255
    The license is stored in Master database.

    To Upload.

    Tools->License Information ->Upload button.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    Yes license is already uploded in Master DB.

    Now I am getting one more issue. I installed 2 NAS some weeks ago. Both are working fine at a time( not simultaneously for sure). I am not sure what happend today, I cannot see second NAS in NASMSnapIN under Appilcation Server for Microsoft Dynamics NAV Manager. However I can see both NAS in Services.( I can even start both the NAS).

    Under Appilcation Server for Microsoft Dynamics NAV im getting the error message :
    Unable to locate Application Server 'GGHAPP01-SQL' running on computer '10.243.105.176'.

    I can see the first NAS though. How can I see second NAS?

    Regards,
    Madhavi
  • Options
    ara3nara3n Member Posts: 9,255
    Add it to MMC right click on Application Server for Microsoft Dyanmics NAV manager and select New and add the service.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    Getting same error message from MMC. :(
  • Options
    ara3nara3n Member Posts: 9,255
    I suggest to contact your partner and let them test your license and make it works with two NASes.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    2 NAS working simultaneoulsy if I define 2 two different companies manully. With Multicompnay and Job queue its not working.

    2 NAS installed under the name HHJ-SQL1 and HHJ-SQL2

    What I did:
    1) Assign all the info manually for one company(Master Company) thru MMC with following parameters in HHJ-SQL1:
    Database Server Name:
    Company Name: MASTER
    Start-UP Parameter := JOBQUEUE|MASTER|{2BFEC4EE-D6FF-4BC0-8A8F-FBE51C21C41D}
    Net Tpe:TCP
    Cache: 8000

    2) Master company - Jobqueue Entry Card
    Object Type to run : Codeunit
    Object ID to run: 50062(Custom define codeunit - allow to add some data in table)
    Parameter String : JOBQUEUE
    Company Name : Atlanta

    3) Master company - Jobqueue Entry Card
    Object Type to run : Codeunit
    Object ID to run: 50062(Custom define codeunit - allow to add some data in table)
    Parameter String : JOBQUEUE
    Company Name : Orlendo

    Now when I run HHJ-SQL1, its run codeunit 50062 for Master Company and the stooped. Never run for Atlanta and Orlendo company.

    What I am expecting that Master company will runs First NAS(HHJ-SQL1) and thru code written in 50001(RunNASforMultiple Comp) will run second NAS(HHJ-SQL2) for Atlanta and Orlendo and will execute codeunit 50062.

    But it not wroking like that.

    Please let me know if my understanding is wrong. Or I am doing something wrong stepwise.
  • Options
    danlindstromdanlindstrom Member Posts: 130
    minicanada wrote:
    2 NAS working simultaneoulsy if I define 2 two different companies manully. With Multicompnay and Job queue its not working.

    2 NAS installed under the name HHJ-SQL1 and HHJ-SQL2

    What I did:
    1) Assign all the info manually for one company(Master Company) thru MMC with following parameters in HHJ-SQL1:
    Database Server Name:
    Company Name: MASTER
    Start-UP Parameter := JOBQUEUE|MASTER|{2BFEC4EE-D6FF-4BC0-8A8F-FBE51C21C41D}
    Net Tpe:TCP
    Cache: 8000

    2) Master company - Jobqueue Entry Card
    Object Type to run : Codeunit
    Object ID to run: 50062(Custom define codeunit - allow to add some data in table)
    Parameter String : JOBQUEUE
    Company Name : Atlanta

    3) Master company - Jobqueue Entry Card
    Object Type to run : Codeunit
    Object ID to run: 50062(Custom define codeunit - allow to add some data in table)
    Parameter String : JOBQUEUE
    Company Name : Orlendo

    Now when I run HHJ-SQL1, its run codeunit 50062 for Master Company and the stooped. Never run for Atlanta and Orlendo company.

    What I am expecting that Master company will runs First NAS(HHJ-SQL1) and thru code written in 50001(RunNASforMultiple Comp) will run second NAS(HHJ-SQL2) for Atlanta and Orlendo and will execute codeunit 50062.

    But it not wroking like that.

    Please let me know if my understanding is wrong. Or I am doing something wrong stepwise.

    Try to remove the bold+underline entries
    1. |MASTER|{2BFEC4EE-D6FF-4BC0-8A8F-FBE51C21C41D}
    2+3. JOBQUEUE
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • Options
    minicanadaminicanada Member Posts: 28
    If I removed |MASTER|{2BFEC4EE-D6FF-4BC0-8A8F-FBE51C21C41D} I am getting the below error message:

    Event Type: Warning
    Event Source: GGHAPP01-SQL-2
    Event Category: None
    Event ID: 20010
    Date: 8/27/2010
    Time: 11:14:06 AM
    User: N/A
    Computer: GGHAPP01
    Description:
    The value of COPYSTR parameter 2 is outside of the permitted range.

    The current value is: -1.
    The permitted range is: from 1 to 2147483647.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


    This error comes due the code written in 50001

    strParamemter := COPYSTR(strParamemter,STRPOS(strParamemter,'|')+1);
    txtFromCompany := COPYSTR(strParamemter,1,STRPOS(strParamemter,'|')-1);
    strParamemter := COPYSTR(strParamemter,STRPOS(strParamemter,'|')+1);
  • Options
    ara3nara3n Member Posts: 9,255
    My code only gets called if startup parameter is JOBQUEUE2 not JOBQUEUE.

    Check your code.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    minicanadaminicanada Member Posts: 28
    Getting the same error message eve if I change from JOBQUEUE to JOBQUEUE2

    Event Type: Warning
    Event Source: GGHAPP01-SQL-2
    Event Category: None
    Event ID: 20010
    Date: 8/27/2010
    Time: 12:56:20 PM
    User: N/A
    Computer: GGHAPP01
    Description:
    The value of COPYSTR parameter 3 is outside of the permitted range.

    The current value is: -1.
    The permitted range is: from 0 to 2147483647.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


    And reson I am gettin this if you see in the code:


    strParamemter := COPYSTR(strParamemter,STRPOS(strParamemter,'|')+1);
    txtFromCompany := COPYSTR(strParamemter,1,STRPOS(strParamemter,'|')-1);
    strParamemter := COPYSTR(strParamemter,STRPOS(strParamemter,'|')+1);

    since strParamemter in NAS1 = JOBQUEUE2, there is no value wheich will filter for STRPOS(strParamemter,'|').
    and that is the reason COPYSTR in txtFromCompany is failed.

    Any idea?
Sign In or Register to comment.