Running a dataport from NAS

CryoCryo Member Posts: 13
edited 2008-12-03 in Navision Attain
Morning,

I'm using Navision Attain 3.60, and I need to run a dataport from NAS.

In the function with ID=99 of Codeunit 1, I have this code:
DATAPORT.RUN(6718,TRUE,rec);
where, 6717 is the ID of my dataport, and rec is a record variable.

When I run NAS, I got this message: "The user-defined C/AL function that takes 5 parameters, was called with 1 parameters."

I don't understand.... :roll:
The format of the run function is still DATAPORT.RUN(Number [, ReqWindow] [, Record])...?

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You can't run a dataport using NAS.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • i4tosti4tost Member Posts: 208
    As i know, you can run. At first, you must change from TRUE to FALSE. You are not able to enter any data in the request form :)
    Another think, try to run this dataport from application. I'm sure, that you will get the same error.
  • CryoCryo Member Posts: 13
    I've tried to run this dataport from the Navision client (by running the codeunit directly), and it's working.

    Could some body tell me why we can't run a dataport from NAS?
    Indeed, I think that NAS is like a function (ID=99) in codunit 1, whish is running all the time.... :roll:

    Thank's
  • i4tosti4tost Member Posts: 208
    Check, where NAS goes it means check function ID=99 and all other object to whom this function goes.
    Or just try to compile all objects and you will find :)
    From Object Designer select all objects and click F11.
  • fbfb Member Posts: 246
    Taken from the C/SIDE Reference Guide:
    The following functions are available when running Navision Application Server:

    All system functions except for the GUI related functions, such as DIALOG and CONFIRM.
    OCX and AUTOMATION functions.
    CODEUNIT functions.
    FILE functions.

    The following functions are not available in Navision Application Server:

    FORM functions.
    REPORT functions.
    Dataport functions.
    Once again,
    You can't run a Dataport using NAS.
    When Luc speaks, others listen. :D
  • CryoCryo Member Posts: 13
    Thank's a lot.... :D

    It's more clear now.

    For Fb, I only listen people who justify their comments :wink:
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    And still it isn't clear :roll:

    When you look at the Changes document from MBS-Navision 3.60, you can read:
    Navision Attain Application Server is now able to run reports and does like the Navision Attain Client. However, there are the following differences:
    • It does not have page setup.
    • It does not have print preview.
    • It will fail if you try to run a report with the request form.
    • It will ignore the status dialog box.

    Navision Attain Application Server can:
    • Print a report.
    • Run a batch report.
    • Save a report as HTML.
    • Save a report as XML.

    So Reports ARE supported in NAS, Dataports and Forms NOT.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • CryoCryo Member Posts: 13
    Thank's again ;)
  • herman.veerkampherman.veerkamp Member Posts: 1
    Recently I also had the unpleasant experience to discover that NAS does not like dataports. I cannot think of any reason why it doesn't as long as there is no requestform. So why do we have a problem, Houston?

    Kind regards,

    Herman
    Kind regards,

    Herman Veerkamp
    software engineer
  • MaximusMaximus Member Posts: 105
    Hi, too bad Dataports can't be run from NAS. I am facing a similar problem and was wondering if the following could be a solution: NAS runs a Report and in the Report the Dataport is called.
    Would be nice to know this before I go about changing all the existing functionality to work with FILE instead of using a dataport. Has anyone got experience with this? Tnx, Max
  • garakgarak Member Posts: 3,263
    also in this case the NAS can't run the dataport.
    But you can use a XMLPort. Do you need DataImport or export?
    Do you make it right, it works too!
  • MaximusMaximus Member Posts: 105
    Hi Garak,

    tnx for your reply. I tested my suggestion this afternoon and the warnings in the event viewer told me that Dataports aren't going to work when called from a NAS, even if called indirectly ;-) What I need is a data import. A 3rd party solution provides me with CSV files which contain lines that have to be turned into Contacts/Customers and ToDo's in NAV. This is functionality we already build for our customer some years ago. Now a Report running in the Job Scheduler which calls a Dataport does the trick. Everything works fine, but the customer wants a more stable solution so that when the server has been shut down, they don't have to manually start the Job Scheduler again. Actually, security settings prevent them from doing it themselves. They always have to call us to do it for them :-) So I guess I have to develop something that uses FILE.SEEK to read the files and replace the functionality that is now provided by the Dataport. Concerning the XML port you suggested: do these work together with NAS? And if so, why do they work and Dataports don't?

    So I guess I have the same question as herman.veerkamp did some time ago. By the way: how are you Herman? Long time no see. Regards, Max
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    I've ran into the NAS cannot run dataports problem recently, so I had to rewrite it as a report. As it is importing a TAB-separated file, it was quite hard at first but managed to figure out - the key is to use InStreams, not just read the file, because just reading the file converts the TABs to spaces. So the general outline how to import TAB-separated stuff in reports (or codeunits is) is:
       File.TEXTMODE(FALSE); //file variable
       File.WRITEMODE(FALSE);
       File.OPEN(FileName);
       CLEAR(LineText);
       TabChr:=9; //char variable
       TabTxt[1]:=LTM_TabChr; //text variable, length=1
       File.CREATEINSTREAM(InStream);
       WHILE NOT InStream.EOS DO BEGIN
           InStream.READTEXT(LineText);
    
           CLEAR(Field1Text); //text variable
           Field2Text:=COPYSTR(LineText,1,STRPOS(LineText,TabTxt)-1);
           LineText:=COPYSTR(LineText,STRPOS(LineText,TabTxt)+1);
           //MESSAGE(Field1Text);
           //EVALUATE it, save it into a record etc.
    
    
           CLEAR(Field2Text);
           Field2Text:=COPYSTR(LineText,1,STRPOS(LineText,TabTxt)-1);
           LineText:=COPYSTR(LineText,STRPOS(LineText,TabTxt)+1);
           //MESSAGE(Field2Text);
    
           //etc,etc now the last field:
           CLEAR(Field8Text);
           Field8Text:=LineText;
           //MESSAGE(Field8Text);
       END;
    
    
    
    
Sign In or Register to comment.