Coding tips (for partners)

Use filter settings of a NAV page

You can start the VJS from a page already containing filters or a specific job

The Visual Jobs Scheduler starts with a request page where you can set up a filter for the jobs to be shown. Proceed as described below if you want to start the VJS from a different page already containing filters or specific jobs

VJS Version 1.1. and below

If you use Visual Jobs Scheduler version 1.1 or below you need to create the function on the VJS Page as well:

  • Open the page “NETRONIC VJS” with Design.
  • Click View àC/AL Globals.
  • Open the “Functions” tab.
  • Add a new function called “SetJobFilter” in the list.
  • Please make sure that the function is not set to be local:
  • Right-click on the line and open the properties. Set local to No.
  • With the new function marked click “Locals”.
vsj_coding_tips_use filter settings_ 1
  • The function needs a job Record as a Var (click into the Var column for the check mark) parameter to pass the filters over to the VJS. In this case, the parameter is called“jobRecPar”.
vsj_coding_tips_use filter settings_ 2
  • Now close the locals and globals windows and look at the C/AL Code (F9).The body of the new VJS function should look as follows (you can copy and paste):
vsj_coding_tips_use filter settings_ code
  • Proceed as described in Example 1 and 2.

VJS version 1.2 and above

If you use Visual Jobs Scheduler version 1.2 or above, you can directly proceed as described in the following examples.

Example 1: Only show project of project card

In this example we will add an action to the Page 88 “Job Card”, so that the VJS will show the job in the Job Card only.

  • Design Page 88 “Job Card” and click View à “Page Actions” (Ctrl + Alt + F4).
  • Now add a new action to the page.
  • With the new action marked press F9 or click View àC/AL Code.

The VJS only passes filters used on the Job record so to get a job record with filters on it we need a local variable in our new action. We also need a VJSPage variable to call our new function and to RUN.

  • Click View à C/AL Locals to open the locals dialog for the action. Here you can add the two needed variables
vsj_coding_tips_use filter settings_ 3

Now for the code of the action:

vsj_coding_tips_use filter settings_ code2

With that, the action will put a filter on our local job variable, so that the “No.” field is the same. Then it passes that filter on to our new VJS function and when the page is run, the filter is used to load only that one job record.

Please note that Jobs with status “completed” will not be loaded by default!

Example 2: Show projects from project list

In this example we will add an action to the Page 89 “Job List”, so that the VJS shows the jobs that are shown in the list.

  • Design Page 89 “Job List” and click View à “Page Actions” (Ctrl + Alt + F4).
  • Now add a new action to the page.
  • With the new action marked press F9 or click View àC/AL Code.

The VJS can use the filters used in the “Job List” Page so we only need a VJSPage variable to call our new function and to RUN.

  • Click View à C/AL Locals to open the locals dialog for the action.

Here you can add the needed variable.

vsj_coding_tips_use filter settings_ 4

Now for the code of the action:

vsj_coding_tips_use filter settings_ code3

With those two lines the Filters that are currently used in the “Job List” Page get passed on to the VJS.

Please note that Jobs of Status “completed” will not be loaded by default, but can be activated on the Setup page!

Also please note that as of Visual Jobs Scheduler Version 1.3 you can also filter resources in the same way, with the function SetResourceFilter, available on the VJS Page.