Friday, 18 July 2008

Combo-Box With Data From List-Group

The data of a combo box can either be populated directly (from OBL) or dynamically using a list group. The list group must return the id and associated name; the id will not be visible but be passed to the item linked to the combo box (in the following example SRCO_ID_PM_TYPE), the name will be shown in the combo box.

BEGIN Combobox cboSRCO_ID_PM_TYPE
Iditem = "SRCO_ID_PM_TYPE"
Left = 174
Top = 4
Width = 300
Height = 20
Listgroup = "../lstgrpSRCO_ID_PM_TYPE"
Collabel = "##TM[SRCO_ID_PM_TYPE]"
END
BEGIN Listgroup lstgrpSRCO_ID_PM_TYPE
Iditem = "SRCO_ID_PM_TYPE"
Watchobject = "*O*../cboSRCO_ID_PM_TYPE.Visible"
BEGIN Function List
Idfuncchannel = "SRCO_PA_MT_PM_TYPE"
Idfuncnode = "SRCO_PA_MT_PM_TYPE"
Idfuncmethod = "LIST"
Mainargs = "ARG_SCO_ID_PM_TYPE"
Mainobjs = "SRCO_ID_PM_TYPE"
Targetitems = "SCO_ID_PM_TYPE,SCO_N_PM_TYPE"
Targetobjs = "SRCO_ID_PM_TYPE,SRCO_N_PM_TYPE"
END
END

Access Value of Slice by Index or Date

To read or write the value of an item with slices, you can either specify the slice directly (item[slice]; the first slice has index 0, and so on) or indicate the date as at which you want to read/write the value.

Syntax:
ItemId[slice] or
ItemId[{date}]

Example:
MY_ITEM with the following three slices
01.07.2008 to 15.07.2008: 20
16.07.2008 to 31.07.2008: 28

To identify the value of the item of the second slice use either:

  • index (starting with 0)
    x = MY_ITEM[1]
  • date (any date that falls within the period of the slice)
    x = MY_ITEM[{2008-07-16}]
    x = MY_ITEM[{2008-07-18}]
    x = MY_ITEM[{2008-07-31}]

To modify the value of the second slice use either:

  • index (starting with 0)
    MY_ITEM[1] = 29
  • date (any date that falls within the period of the slice)
    MY_ITEM[{2008-07-16}] = 29
    MY_ITEM[{2008-07-18}] = 29
    MY_ITEM[{2008-07-31}] = 29

Note: It is also possible to combine this type of access with the access by node structure index:

NodeStructureID[Index].ItemId[slice] or
NodeStructureID[Index].ItemId[{date}]

Access Values of Node Structure by Index

To identify the value of an item of a node structure, you can either position on the correct register (e.g. Begin, MoveTo, End) or use an index.

Syntax: NodeStructureID[Index].ItemId

Example:
x = MY_NODE_STRUCTURE[1].MY_ITEM

Note: The advantage of using the index is that the current position of the node structure is not modified. That means you do not need to recover the position after moving (if relevant) and the system does not need to update the position pointers (specially if the node structure you access has more nodes beneath it).

Thursday, 17 July 2008

[Workflow] Notification via Email

The user can be informed via email that a task has been assigned to him. The subject of the email contains the BPC description. The file .m4, which can be used to run the task directly in windows/rich client, is attached. The body of the email contains the state description and, if available, a URL to run the task in light client.



To enable the URL in the email, the two following conditions have to be met:

  1. The application parameter WORKFLOWRT / THINCLIENT / SERVER_URL should have a valid value, e.g. http://server.meta4.com:8100/.
  2. The task associated to the state should have code of type Thin Client Code assigned that contains two variables that ends with:
    "_PREINITTASKPAGE" that is generic, e.g. "_PREINITTASKPAGE=/sse_generico/##LANG##/generico_login.jsp?_A=/servlet/CheckSecurity/JSP&znivel=1&_B=/sse_generico/generico_invisible.jsp&_C="
    "_INITTASKPAGE" that indicates the page to be called, e.g. "_INITTASKPAGE=/mss_g1/mss_g1_p1_val.jsp?estado=11".

Note: The only dynamic parameter passed to the page is the work-item id (ID_WORKITEM) that is added automatically.

Example URL:

http://server.meta4.com:8100/sse_generico/english/generico_login.jsp?_A=/servlet/CheckSecurity/JSP&znivel=1&_B=/sse_generico/generico_invisible.jsp&_C=/mss_g1/mss_g1_p1_val.jsp?estado=11&ID_WORKITEM="work-item"
New in version 7.1 SP002 (of technology)
By default, the subject and the text of the email are retrieved from the description of the workflow and the description of the state; now exists the possibility to define an alternative subject/text for the email.

[Workflow] Identify Siblings of Workitem

This API returns the number of siblings of the given workitem that are in the same state, active and belong to the current user.

The details related to each workitem are provided in the main node of the Meta4Object (one record per work-item). The method Get Value can be used to identify the value of the BPC variables.

It can be used to identify, e.g. all employees with vacations pending approval. The user has a task assign to approve the vacations of a specific employee. To avoid that the user has to enter the presentation for each request individually, all pending requests can be identified and worked off at the same time.


Technical details
  • Meta4Object: SWF_INSTANCE
  • Node Structure: SWF_INSTANCE
  • Method: GET_WORKITEM_SIBLINGS (ARG_ID_WORKITEM)
    Returns number of siblings of the given workitem.The work-items can be retrieved from the property ID_WORKITEM.
  • Method: GET_VALUE (ARG_ID_VARIABLE)
    Returns the value of the given variable for the currently positioned record.

[Workflow] Accept Code of Transition

The Accept Code of a transition is executed as a just-in-time call in the environment of the workflow engine when the transition is followed. It should return M4_SUCCESS; if it returns M4_ERROR, the workflow engine stops with an error.

It can be used to e.g. assign a value to a BPC variable, issue a message or cancel a transition.

Example: Issue warning message that includes the Person ID.
//Workflow for 0%:s instantiated
SetLog(M4_WARNINGLOG, 18, xx, yy, SWF_INST_DATA.Get(“ID_PERSON”))
Return(M4_SUCCESS)

Where xx and yy indicate the sub-module and number of the message to be issued.

[Workflow] Identify Existing Instance

This API returns the number of active instances of a given BPC that match the passed variables.

The details related to each workitem are provided in the main node of the Meta4Object (one record per workitem). The method Get Value can be used to identify the value of the BPC variables. If the state is not linked to the current user, the workitem has the value “N/A”.
It can be used, e.g. in the Hire to identify if a person is involved in a recruitment process and should not be hired yet because of pending approval or because the task to hire the person is assigned to a different user.


Technical details
  • Meta4Object: SWF_INSTANCE
  • Node Structure: SWF_INSTANCE
  • Method: GET_INSTANCES (ARG_ID_BPC, tuples ID Variable / Value)
    Returns number of instances of the given BPC that match the variables.The workitems can be retrieved from the property ID_WORKITEM (if the task is assigned to the current user, otherwise is the value “N/A”).
  • Method: GET_VALUE (ARG_ID_VARIABLE)
    Returns the value of the given variable for the currently positioned record.

[Workflow] Range for Auto-Numeric IDs

All elements of the workflow (states, transitions, events, and so on) use auto numeric ids. To avoid conflicts upon updates, the following ranges have been established and should be respected.

Range for IDs (Application Parameter: Mind / Version / Range)
0000 – 0499: Existing
0500 – 0999: Technology
1000 – 1999: Corporate
2000 – 2199: France
3800 - 3999: Spain (private sector)
4000 – 4199: Spain (public sector)
2200 – 7999: Other countries
8000 – 9999: Client

Note: The default value of these application parameters corresponds to the range of the client.

Wednesday, 16 July 2008

Dump Presentation (OBL) to File

Use the following instruction to generate a file with the complete OBL code of a presentation. This is very powerful because all includes are resolved.

From developer taskbar run: ID_PRESENTATION,s:C:\FILE.OBL

ID_PRESENTATION: ID of presentation
C:\FILE.OBL: Output file including path (extension is not fixed)

Example:
SRCO_PA_MN_HIRE,s:c:\obl\SRCO_PA_MN_HIRE.obl