run dataports both from code and from menu

AleSlammerAleSlammer Member Posts: 25
Hi

I am making an upgrade tool for in Navision 5 where you are supposed to run severel dataports automatically from the code. It works just fine, when I set the UseReqForm property for the dataport objects to "No" and then run the code. My problem is that there is menuitems running these dataports. Obviously it is a problem that there is no requestform for the users.

I want to somehow skip the requestform from the code (I know the dataport.run where a parameter says whether to show requestform or not). The thing is that I also want to set other properties, which I can't from that function.
Or if I could somehow make a nice solution where I keep the UseregForm properties on the dataport objects set to No and then somehow is still able to run the dataports from the menu, without having to make a new codeunit for every dataport, that uses the DATAPORT.RUN and skip the request window. Please tell me there is a better way ](*,)

Answers

  • kylehardinkylehardin Member Posts: 257
    Have you tried adding a function (or several) to the dataport that can set the parameters you want, then call those functions from the codeunit?
    Kyle Hardin - ArcherPoint
  • AleSlammerAleSlammer Member Posts: 25
    Hi Kyle and thanks for answering. I have tried making a function and tried with
    CurrDataport.USEREQFORM(FALSE);
    
    and
    CurrDataport.USEREQUESTFORM(FALSE);
    
    The dataport wasn't able to compile that. :-k
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    DATAPORT.RUNMODAL(Number [, ReqWindow] [, Record])
    
  • AleSlammerAleSlammer Member Posts: 25
    Hi Mohana and thanks for answering. I have thought about that solution, but I can't set the direction or filename in that command, and I can't use that Command with a variable of my dataport as the first parameter - it requires an integer :-k
    I wan't to first set the IMPORT(TRUE) and then specify the FILENAME before running the dataport without showing the request form
  • MBergerMBerger Member Posts: 413
    I have made a similar tool not too long ago. I use a single instance codeunit to pass the parameters, setting them from the calling code and reading them from the dataport, so maybe that is worth having a look at.
  • AleSlammerAleSlammer Member Posts: 25
    mBerger <-- thanks. It works great \:D/
Sign In or Register to comment.