Invoking Form 221, Resource Allocated per Job

bhalpin
bhalpin Member Posts: 309
Hello.

From a command button, I am trying to find a/the way to run form 221, "Resource Allocated per Job", but set the Resource Filter to a given value.

I've been all over the button properties, but can't seem to find the 'magic', if indeed there is any. I have scoured the code of the forms involved, traced manually setting it while under the debugger, etc.

Can anyone point me in the right direction here?

Thanks' in advance.

Bob

Answers

  • DaveT
    DaveT Member Posts: 1,039
    Hi Bob,

    First of all create a function e.g. SetResFilter in form 211 passing an arguement of ResFilter and add the line of code

    setfilter( "resource filter", ResFilter );

    then declare a variable for form 211, e.g ResourceAllocation, in the calling form. In onpush trigger of the button put

    ResourceAllocation.SetResFilter( MyFilter );
    ResourceAllocation.runmodal;

    You may have to play around with the code but the idea is sound.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • bhalpin
    bhalpin Member Posts: 309
    Hi Dave.

    Thanks. I could not get that to work, but I found another solution.

    I added a command button for each resource, and in the OnPush trigger for each I put code like:
    // Job is Record, table Job
    // ResourceAllocation is Form 221
    Job.SETFILTER("Resource Filter",'WHATEVER');
    ResourceAllocation.SETTABLEVIEW(Job);
    ResourceAllocation.RUNMODAL;
    

    That did the trick nicely.

    Bob
  • bhalpin
    bhalpin Member Posts: 309
    Hi Dave.

    Thanks. I could not get that to work, but I found another solution.

    I added a command button for each resource, and in the OnPush trigger for each I put code like:
    // Job is Record, table Job
    // ResourceAllocation is Form 221
    Job.SETFILTER("Resource Filter",'WHATEVER');
    ResourceAllocation.SETTABLEVIEW(Job);
    ResourceAllocation.RUNMODAL;
    

    That did the trick nicely.

    Bob