Generic renumber tasks for all your screens with an order number


Userlevel 5
Badge +8

Goal

Something that can often occur in your projects is working with order numbers. This is also done in the Software Factory itself. In our case, when the column "order_no" (for example, 10 and 20) exists, the column "abs_order_no" (in that case 1 and 2) pretty much always also exists.

Now you may want to increase the "order_no" for each record by 10. When you add several new records between 2 records, the increment of 10 between these records is interrupted. To correct this, we have renumber tasks in the Software Factory. By using these tasks, the increment between the order numbers will be restored using the "abs_order_no".

These renumber tasks are created dynamically in the dynamic model of the SF. I would like to share this concept with you. This is the model part. But I'll also include the control procedure code and template code for the code of the renumber tasks itself. Let's get you inspired!

Solution

  1. Create the tasks by executing the dynamic model code in the zip-file.
  2. Create the control procedure ‘task_renumber_tasks’. This code contains a bit SF-specific adjustments, but perhaps this will inspire you to make a similar adjustment for your end product. Please check what you can use, and adjust it to your wishes for your end product.
  3. Create the corresponding templates so the tasks do not only exist in the model, but also executes code.

Conditions dynamic model

To successfully use this certain conditions have to be met. Of course you can have other conditions for your own project. In that case, don't forget to update them in the script. The current conditions are:

  • The table on which the task is created contains:

    • a column with the domain "order_no",

    • a column named "abs_order_no".

  • The table is editable

  • The column with the domain "order_no" is editable in all ways:

    • at column level

    • at form level

    • at grid level

Steps dynamic model

The steps taken in the script are as follows:

  1. Declare temporary tables
  2. Fill temporary tables
    1. Fill the "Desired task" temporary table
    2. Fill the "Desired task parameter" temporary table
    3. Fill the "Desired task variant" temporary table
  3.   Add the objects, using the temporary tables
    1. Add the confirmation messages for the renumber tasks
    2. Add the task
    3. Add the task parameters
    4. Insert a table task group that will be used for the renumber task
    5. Add the table task    
    6. Add the table task parameters
  4. Update the variants
    1. Update the variants so the renumber tasks are shown when present in the desired_task_variant temp table
    2. Update the variants so the renumber tasks are not shown when not present in the desired_task_variant temp table
  5. Add the translations
    1. Add the translation objects
    2. Update the translation objects for the confirmation message
    3. Update the translation objects for the tasks
  6.   Remove all non-desired objects
    1. Remove all non-desired task groups
    2. Remove all non-desired tasks
    3. Remove all non-desired task_parmtrs
    4. Remove all non-desired messages

0 replies

Be the first to reply!

Reply