Support > Repository > Function > Account
ja | en

Here are three functions related to account processing.

USERNAME()

Returns the logon account name.

Example: If the logon account is "admin", set the string "administrator", otherwise set the string "general".

>IF (EXACT (USERNAME (), "admin"), "administrator", "general")

USERINFO (item name)

USERINFO (item name # id)

Return information about the logon account.For the argument, specify the item name (English) of the juser model.

The return type is a string.

For repeated items, specify item.0, item.1. For repeating containers, specify cont.0.str.

If there is more than one value such as a check box, it returns a single character string with "space" as delimiter.

If the target item is model reference, "item name" returns content part, "item name # id" returns ID part.(Note that the ID part is also always a character string type.)

Example 1: Obtain full name information of the logon account.

USERINFO("name")

Example 2: We prepared the item "companyname" which refers to another model "company" in the juser model.Get the ID part of the companyname item.

USERINFO("companyname#id")

If the model referred to by the reference item is a compound primary key, the first primary key is "#id", but the second primary key is referred to by "# id 2".After that, it becomes "# id3", "# id4", ....

Details

The return value of the USERINFO function is set at logon

The return value of the USERINFO function is prepared by reading the value of the juser table once at logon.Because of this method, the USERINFO function may return old value (before updating) after updating juser.

Return value null is not returned

The return value of the USERINFO function is never null.If there is no value, it returns the null character "".

When using it for the condition part of the IF function, instead of using USERINFO ("name") == null, use the ISBLANK function as follows to make a judgment.

IF(ISBLANK(USERINFO("name")), ...)

JGROUPID()

Returns an array (integer type) of the group ID to which the logon account belongs.Values ​​are listed in ascending order.

Example: If the group to which the user belongs is "not" or belongs to group ID 1000, return null, otherwise return the first group ID (belonging).

IF (OR (ISEMPTY (JGROUPID ()), CONTAINS (JGROUPID () (1000)), null, CHOOSE_INT (1, JGROUPID ()))

We assume the group "Head office, A business office, B business office, C office".We will set the head office group ID to 1000.
Assume that employees belonging to the head office belong to all business establishments A, B and C.
Prepare a group (item referring to jgroup) on the search screen so that you can search by group.The reference type is a combo box.If you set the above expression as the initial value of the search screen here, if the headquarters is included in the group to which it belongs, the initial value of the search condition is "(all)" (null).If the head office is not included, set the first one in the combo box.