System functions

Completed

System functions are the type of functions that you can use out of the box. They aren't related to a certain data type or used for interaction. You can find them throughout the system, and you can use them in every trigger or procedure.

System functions include:

  • UserID

  • CompanyName

  • Today

  • Time

  • WorkDate

UserId and CompanyName functions

You can use the UserId function to know who is running code. Imagine that you are posting an order in the posting process and you want to keep track of who posted the order. The UserId function helps you accomplish this task.

<Text> := UserId();

In the logical database, you might have one or multiple companies. If you want to figure out the name of the company that the code is running in, you can use the CompanyName function. This function fetches the current company name.

<Text> := CompanyName;

Today, Time, and WorkDate functions

Similar to Date2DMY and Date2DWY, the Today function is another date function that you can use to get the current date from the operating system.

<Date> := Today();

The Time function works the same way and returns the current time from the operating system.

<Time> := Time();

With the WorkDate function, you can get or set the work date for the current session.

<Date> := WorkDate();   // Get the work date
WorkDate(<Date>);       // Set the work date