Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

Overview Of Longview Application Framework

Longview Application Framework is the interface used for developing custom business logic within your Longview system.

Longview Application Framework performs the following tasks:

  1. Handles interaction between the Longview Server and an already-deployed Longview App through the Longview API layer.
  2. Can be run directly from a command prompt in batch mode, and permits the scheduling of tasks via third-party software.

In this section, you can find information on the following topics:

Syntax with connection parameters

To run Longview Application Framework in batch mode, the executable file (lv_af.exe) requires the following syntax:

lv_af User/Password Host Port LID V3_COMPATIBLE_ACCESS Group Proc [LanguageCode] [Param=Value]

where:

  • User/Password is the Data Server user name and password. If using Windows authentication, use "/".
  • Host is the host machine of the Data Server.
  • Port is the listener port number of the Data Server.
  • LID is the Longview Identifier of the Data Server.
  • Group is the name of a user group.
  • Proc is the name of the Procedure document to run, or the path of the Procedure document if it is in a different directory. The Procedure document must be a text file, and the file name can have any extension.
  • LanguageCode is the optional language code, with a default value of EN.
  • Param is optional and is the variable to which to pass the value. You can pass more than one parameter as long as the variable is unique.
  • Value is the value to pass to the related Param.

Note: You must enclose values that contain spaces or Windows Command Shell special characters, such as ampersands ( & ), pipes ( | ), and parentheses, in double quotation marks.

Example 1: Code

lv_af Admin/Admin1 e3000 20001 lv34 default proccopy.txt EN

Example 2: Code

lv_af Admin/Admin1 e3000 20001 lvProd V3_COMPATIBLE_ACCESS Administrators proccopy.txt EN Entities=TCANADA

Example 3: Code

lv_af Admin/Admin1 e3000 20001 lvProd V3_COMPATIBLE_ACCESS Administrators proccopy.txt EN Entities="Total Canada"

Example 4: Code

lv_af Admin/Admin1 e3000 20001 lvProd V3_COMPATIBLE_ACCESS Administrators proccopy.txt EN Entities="Canada|USA"

Syntax with connection parameters in Procedure document

lv_af Proc [Param=Value]

where:

  • Proc is the text file that contains the commands or documents to execute or call, including connection parameters. This may include a command or an action to call or invoke another document.
  • Param is optional and is the variable to which to pass the value. You can pass more than one parameter as long as the variable is unique.
  • Value is the value to pass to the related Param.

Issuing commands

Longview Application Framework can be called from a System Administrator’s computer, using the command prompt.

Commands and documents are available in Longview Application Framework. Commands may execute actions or call documents, which may invoke further commands. Documents are ASCII text files that outline parameters for actions, or additional actions to take.

The interface does not currently provide a Graphical User Interface (GUI)—it is command-line based. All parameter values are non-case sensitive.

Batch Mode syntax

To run Longview Application Framework in batch mode, the executable file (lv_af.exe) requires the following syntax:

lv_af Script

lv_af User/Password Host Port DSID AccessRole Script [LanguageCode]

For more information on calling commands from Longview Application Framework documents, see Understanding document types.

Understanding document types

A Longview Application Framework document is a text-based file containing instructions for Longview Application Framework. To ensure that all commands, functions, and Models invoked within your documents work as desired, you should save your Longview Application Framework documents as ASCII files rather than as Windows ASCII binary files.

Longview Application Framework has several types of documents used for different purposes. All Longview Application Framework documents can be run by users in batch mode, from a command prompt.

Caution: The use of the asterisk as a multiplication symbol in the application requires that it be enclosed in double quotation marks ("*"). An asterisk without double quotation marks is interpreted by the system as a wildcard search character, and operations that include it will not give the expected results.

Conforming to file extension conventions

Longview recommends that you follow standard naming conventions when you create Longview Application Framework documents.

Document type Recommended Extension Applies to…

Longview App Configuration File

lvapp

Longview Smart Client

DataArea Spec

lvdsp

Longview Smart Client

Longview Application Framework

DataView definition

lvdvw

Longview Smart Client

DataTable definition

lvdtd

Longview Smart Client

Table View definition

lvtvw

Longview Smart Client

Calendar View definition

lvcvw

Longview Smart Client

Form document

lvfrm

Longview Smart Client

ImportSpec

lvimp

Longview Smart Client

Longview Application Framework

ExportSpec

lvexp

Longview Smart Client

Longview Application Framework

CalculatedJESpec

lvcje

Longview Application Framework

Symbol Map

lvmap

Longview Smart Client

Longview Application Framework

Model

lvmod

Longview Smart Client

Longview Application Framework

Procedure

lvpro

Longview Smart Client

Longview Application Framework

Subroutine

lvsub

Longview Smart Client

Longview Application Framework

UI

lvui

Longview Smart Client

HTML

html

Longview Smart Client

Conforming to naming conventions

For some commands and functions, you create a certain item in Longview, such as a document or symbol, and apply an appropriate name. Make sure your system can use the names you specify.

Symbol names

To create a valid symbol name, follow these guidelines:

  • Symbol names can contain only letters, numbers, periods ( . ), and underscores ( _ ); do not use spaces, other punctuation, or other special characters.
  • Symbol names cannot contain more than 31 characters.
  • Symbol names must be unique in the system.

Note: Numeric symbol names must be prefixed by the exclamation point character “!” when used in a Model or equation. For example !22342 identifies 22342 as a symbol name and not a numeric value.

Symbol descriptions

Symbol descriptions can contain a maximum of 100 characters.

Symbol hierarchies

Symbols are usually grouped together in relationships called parent, child, and leaf symbols.

Symbol Type Description

Parent

A parent is any symbol under which other symbols are grouped. It is possible for a symbol to be both a parent symbol

Child

A child is any symbol grouped under another symbol. It is possible for a child symbol to itself be the parent symbol for another child symbol or symbols, as well as the child of another parent symbol.

Leaf

A leaf is any symbol with no child symbols grouped under it, regardless of how many levels deep in the hierarchy it resides.

Root

A root symbol resides in the first level of the hierarchy and does not have a parent symbol. It is possible for a root symbol to be the parent symbol of another symbol or symbols.

Symbol hierarchy is central in Longview applications to displaying the relationships between symbols and how their values relate to one another.

Rollup Indicator Meaning

+

The child symbol’s value is added to the parent symbol’s value.

-

The child symbol’s value is subtracted from the parent symbol’s value.

0

The child symbol’s value does not alter the value of the parent symbol.

User IDs

The requirements for user IDs depends on the authentication method used by your company.

User descriptions

A user description is usually the full name of the user. User descriptions can contain a maximum of 100 characters.

A user ID must follow these guidelines:

Authentication Guidelines

Longview authentication

If your company uses Longview authentication, follow these guidelines for user IDs:

  • may include maximum of 63 characters
  • may include any number, and any letter, uppercase or lowercase
  • may contain spaces anywhere within the name, but not at the very end
  • may include the following special characters: # _ ! ~ ‘ and .
  • cannot include any other special characters, such as the backslash ( \ )

Windows authentication

If your company uses Windows authentication, use the user’s

Windows user ID, following these guidelines:

  • must include the domain name, a backslash, and the Windows user ID; for example: CONNECT \ Host Port LID [Group]
  • may include the following special characters: # _ ! ~ ‘ and .
  • cannot include any other special characters

Working with system variables

Longview provides you with several system variables to store commonly used system information. For example, you can use the ExportVariable function with system variables to export the information stored in the variable to a file. You can also use the Show Message command with system variables to display the information stored in the variable in a message window when you are creating Longview Apps.

The following system variables can be used in Procedures, Model, and Data View documents.

Using the LVS_BATCH_IDS system variable

This variable stores the batch IDs of the latest batches that result from any of the following commands and functions:

Note: When using LVS_BATCH_IDS in conjunction with JournalEntryPost() and JournalEntryUnpost() functions, only the last batch ID is returned.
Therefore, you should poll the LVS_BATCH_IDS value after each JournalEntryPost() and JournalEntryUnpost() action in order to retrieve the appropriate batch ID.

Syntax example

Create Variable slvs_Batch_IDS[] as String

Set Variable slvs_Batch_IDS[] = STRREPLACE( "$LVS_BATCH_IDS$", "@", "|" )

Using the LVS_BLUR_ID system variable

This variable stores the label of the tab in a Data Grid that has lost focus after a user switches from one tab to another in a tabbed Data Grid.

Syntax example

Create Variable slvs_Blur_ID as String

Set Variable slvs_Blur_ID = "The $LVS_BLUR_ID$ tab has lost focus" Show Message "$slvs_Blur_ID$"

Using the LVS_BUTTONCLICKED system variable

This variable stores a user’s button selection such as OK or Cancel, for example, in a dialog using the ShowFileChooser or ShowSymbolSelector function.

Syntax example

Create Variable slvs_ButtonClicked as String

Set Variable slvs_ButtonClicked = $LVS_BUTTONCLICKED$

Using the LVS_ERRORCODE system variable

If the system encounters an error, the error code is stored in this variable.

Syntax example

Create Variable nlvs_ErrorCode as Num

Set Variable nlvs_ErrorCode = $LVS_ERRORCODE$

Using the LVS_ERRORMESSAGE system variable

If the system encounters an error, the error message is stored in this variable.

Syntax example

Create Variable slvs_ErrorMessage as String

Set Variable slvs_ErrorMessage = $LVS_ERRORMESSAGE$

Using the LVS_EVENT_ID system variable

This variable stores the event IDs of the current process. If the process has not started as a result of an event, the value returned is -1.

Syntax example

Create Variable nlvs_Event_ID as Num

Set Variable nlvs_Event_ID = $LVS_EVENT_ID$

Using the LVS_FETCHINDEX system variable

Use this variable to retrieve the row index of the currently fetched row in the cursor. You could use this variable in conjunction with the SetDataTableCell function to, for example, update an existing value with a new value.

Syntax example

Set Variable nResult = SetDataTableCell (myDataTable, $LVS_FETCHINDEX$, $colIndex$,

$newSalary$)

Using the LVS_FETCHSTATUS system variable

Use this variable to retrieve the status of the Fetch command.

This variable is set to one of the following values, depending on the outcome of the Fetch command:

  • 0—The Fetch command was successful, and a string is stored in the relevant variable.
  • -1—The Fetch command was unsuccessful (the cursor moved past the result).
  • -2—The Fetch command was unsuccessful (the result is marked as deleted or ignored). This could occur when a row has been deleted through the user interface, but the changes have not yet been submitted.

Syntax example

If $LVS_FetchStatus$ EQ 0

Run Model TransferTableData.lvmod

End If

Using the LVS_FILESCUSTOMROOTPATH system variable

This variable stores the path of the Files Custom Root Folder.

Syntax example

Create Variable sFilesCustomRootPath as String

Set Variable sFilesCustomRootPath = "The Files Custom Root Path is $LVS_FILESCUSTOMROOTPATH$"

Show Message “$sFilesCustomRootPath$”

Using the LVS_FOCUS_ID system variable

This variable stores the label of the tab in a Data Grid that has gained focus after a user switches from one tab to another in a tabbed Data Grid.

Syntax example

Create Variable slvs_Focus_ID as String

Set Variable slvs_Focus_ID = "The $LVS_FOCUS_ID$ tab has gained focus"

Show Message "$slvs_Focus_ID$"

Using the LVS_HTTPPROTOCOL system variable

This variable stores the type of http protocol. Possible return values are HTTP and HTTPS.

Syntax example

Create VARIABLE sHttpProtocol as String

Set VARIABLE sHttpProtocol = "The Http Protocol is: $LVS_HTTPPROTOCOL$"

Show Message "$sHttpProtocol$"

Using the LVS_IDENTIFIER system variable

This variable stores the Longview Identifier of the system.

Syntax example

Create Variable slvs_Identifier as String

Set Variable slvs_Identifier = "The Identifier is: $LVS_IDENTIFIER$"

Show Message "$slvs_Identifier$"

Using the LVS_LANGCODE system variable

This variable stores the language code of the system. Possible return values are EN and FR.

Syntax example

Create VARIABLE sLangCode as String

Set VARIABLE sLangCode = "The Language code is: $LVS_LANGCODE$"

Show Message "$sLangCode$"

Using the LVS_LISTDELIMITER system variable

This variable stores the delimiter for STRING and NUM list variables in the current instance, as set by the UseListDelimiter command.

Syntax example

Create Variable slvs_ListDelimiter as String

Set Variable slvs_ListDelimiter = "$LVS_LISTDELIMITER$"

Using the LVS_RDBMS system variable

This variable stores the current database type (SQL or ORACLE).

Syntax example

Create Variable slvs_RDBMS as String

Set Variable slvs_RDBMS = $LVS_RDBMS$

Using the LVS_SESSIONID system variable

This variable stores the current session ID.

Syntax example

Create VARIABLE sSessionID as String

Set VARIABLE sSessionID = "The session ID is: $LVS_SessionID$"

Show Message "$sSessionID$"

Using the LVS_USERID system variable

This variable stores the username of the current user.

Syntax example

Create Variable slvs_UserID as String

Set Variable slvs_UserID = "Hello $LVS_USERID$"

Show Message "$slvs_UserID$"

Using the LVS_USERGROUP system variable

This variable stores the user group of the current user.

Syntax example

Create Variable slvs_UserGroup as String

Set Variable slvs_UserGroup = "Current user is in the $LVS_USERGROUP$ user group"

Show Message "$slvs_UserGroup$"

Using the LVS_WEBBRIDGE system variable

This variable stores the path and file for the .cgi or .dll bridge file for the web bridge, such as "/cgi-bin/LID/lvweb.cgi", where LID is the Longview Identifier for the system.

Syntax example

Create VARIABLE sWebBridge as String

Set VARIABLE sWebBridge = "The web bridge is: $LVS_WebBridge$"

Show Message "$sWebBridge$"

Using the LVS_WEBBRIDGEPATH system variable

This variable stores the path for the .cgi or .dll bridge file for the web bridge, such as "/cgi-bin/LID/", where LID is the Longview Identifier for the system.

Syntax example

Create VARIABLE sWebBridgePath as String

Set VARIABLE sWebBridgePath = "The web bridge path is: $LVS_WebBridgePath$"

Show Message "$sWebBridgePath$"

Using the LVS_WEBSERVER system variable

This variable stores the web server, such as ca127dev12.

Syntax example

Create VARIABLE sWebServer as String

Set VARIABLE sWebServer = "The web server is: $LVS_WebServer$"

Show Message "$sWebServer$"

Working with system variables for persistent event rules

Longview provides you with the LVS_EVENTINITIALIZE, LVS_EVENTSHUTDOWN, and LVS_PERSISTENT system variables, which are used in conjunction with persistent event rules. A single Management Server process is launched to handle persistent events in the following scenarios:

  • when the server is started
  • if maintenance is turned off
  • if application framework is disconnected and a persistent event rule is triggered

The Management Server process remains in the system until the data server is shut down, in order to handle each successive triggering of the persistent event. For more information on persistent event rules, see the Longview Application Administrator Guide.

Note: If you make any changes to the list of persistent event rules (in either the Persistent Event Rule Setup dialog, or the rulepersists.txt file) or the name of the procedure launched by the persistent event rules, you must restart the servers for your changes to take effect.

Using the LVS_EVENTINITIALIZE system variable

This variable indicates if the current process is run as a result of the Management Server starting, or not. While the servers are starting, the corresponding event procedure is run.

You can use this variable within the event procedure to define what to run upon initialization. This variable should be used to ensure that the actual calculation is not run when the event procedure is run as a result of the Management Server starting.

For instance, (in the Persistence syntax example) if the servers are starting, the LVS_EVENTINITIALIZE variable indicates that the create persistent lock procedure should be run.

Using the LVS_EVENTSHUTDOWN system variable

This variable indicates if the current process is run as a result of the Management Server stopping, or not. While the servers are stopping, the corresponding event procedure is run.

You can use this variable within the event procedure to define what to run upon shutdown. This variable should be used to ensure that the actual calculation is not run when the event procedure is run as a result of the Management Server stop- ping.

For instance (in the Persistence syntax example), if the servers are stopping, the LVS_EVENTSHUTDOWN variable indicates that the delete persistent lock procedure should be run.

Using the LVS_PERSISTENT system variable

This variable indicates if the current process is persistent or not. When an event is triggered, the corresponding event procedure is run. You can use this variable within the event procedure to define what to run for a persistent event. This variable should be used to ensure that commands that connect to and disconnect from Application Framework are not run when the event is a persistent event.

For instance (in the Persistence syntax example), in cases where the current process is not persistent, the LVS_PERSISTENT variable indicates that locks for event rule processes that are not persistent should be created and deleted.

Persistence syntax example

syntax

If $LVS_EventInitialize$ AND $LVS_Persistent$

// create persistent lock

Create LOCK USER using "bigdataspec.lvdsp"

Else

If $LVS_EventShutDown$ AND $LVS_Persistent$

// delete persistent lock

Delete LOCK USER using "bigdataspec.lvdsp"

Else

If Not $LVS_Persistent$

// create lock if persistence not used

Create LOCK USER using "smalldataspec.lvdsp"

END If

// create and download data area

Create DATAAREA da using "smalldataspec.lvdsp" Download da

// run model

Run MODEL "calc.lvmod" on da

// upload data area Upload da

If Not $LVS_Persistent$

// delete lock if persistence not used

Delete LOCK USER using "smalldataspec.lvdsp"

END If

END If

END If

Working with context variables

Longview provides you with several context variables populated with App context- related information. When a user right-clicks a cell or clicks a toolbar button in a Data Grid or a Table, an action is triggered, and specific context variables are populated.

The following context variables can be used in Longview Application Framework documents:

Variable Returns… Example

C_CONTEXT
(for Data Grids)

a user’s click selection in a Data Grid. If the user clicks a cell, the return value is CELL. If the user clicks a toolbar action, the return value is DATAGRID.

$C_CONTEXT$ resolves to CELL or $C_CONTEXT$ resolves to DATAGRID

C_CONTEXT
(for Tables)

  • If the user right-clicks on the row header, the return value is ROW.
  • If the user clicks a toolbar action, the return value is TABLE.
  • If the user manually edits data in a cell or edits data using a UI control, the return value is DYNAMICCELLEDIT.
  • If the user invokes the standard row operation Add, the return value is DYNAMICADD.
  • If the user invokes the standard row operation Duplicate, the return value is DYNAMICDUPLICATE.
  • If the user invokes the standard row operation Delete, the return value is DYNAMICDELETE.
  • If the user invokes the standard row operation Edit, the return value is DYNAMICEDIT.
  • If the user invokes the standard row operation Reset, the return value is DYNAMICRESET.
  • If the user invokes the standard row operation Reset All, the return value is DYNAMICRESETALL.
  • If the user pastes multiple values into a table, when pasting the first value and subsequent values (except the last value), the return value is BEGINMULTI- PASTE.
  • If the user pastes multiple values into a table, when pasting the last value, the return value is ENDMULTIPASTE.

$C_CONTEXT$ resolves to ROW or TABLE

C_DATAAREA

the name of the related data area.

$C_DATAAREA$ resolves to SampleDA

C_DATATABLE
(for Tables)

the name of the Data Table object.

$C_DATATABLE$ resolves to SampleDT

C_CELLVALUE
(for Data Grids)

the value of the intersection after a user right-clicks a cell in a Data Grid. This variable is not populated for toolbar actions.

$C_CELLVALUE$ resolves to 200

C_CELLVALUE
(for Tables)

the value of the intersection of an edited cell in a Table. This variable is not populated for toolbar actions or row context actions.

$C_CELLVALUE$ resolves to 200
C_CELLVALUE
PRIOR
(for Tables)

the previous value of the intersection after a user has edited a cell in a Data Table. This variable is not populated for toolbar actions or row context actions.

$C_CELLVALUEPRIOR $ resolves to 100

C_ROWINDEX

the number of the corresponding row index in the Data Table object in which the user has right clicked. If C_CONTEXT resolves to TABLE, this variable resolves to 0.

$C_ROWINDEX$ resolves to 2

C_ROWS

the dimension in the rows orientation of the Data Grid. If the Data Grid has nested dimensions in the rows orientation, the variable returns the dimensions in order from outer to inner.

$C_ROWS$ resolves to ENTITIES, ACCOUNTS

C_SOURCE
ROWINDEX

the number of the corresponding row index in the Data Table Object that the user has duplicated.

$C_SOURCEROWINDEX$ resolves to 1 when the first row in the table is duplicated

C_COLUMNS

the dimension in the column orientation of the Data Grid. If the Data Grid has nested dimensions in the columns orientation, the variable returns the dimensions in order from outer to inner.

$C_COLUMNS$ resolves to TIMEPER

C_DIMENSION

the name of the symbol for each dimension at the intersection that the user right clicked. For toolbar actions, these variables are populated only for dimensions that are not in the rows or columns orientation. The names of the variables in Longview Application Framework to be used in these context variables are limited to 31 characters. The convention is C_DIMENSION (where DIMENSION is the first 26 characters of the dimension name). In the case where the first 26 characters of the dimension names are the same, the variables are named C_DIMENSION_N (where DIMENSION is the first 26 characters of the dimension, and N is the dimension number).

$C_CURRENCIES$ resolves to CAD or $C_ENTITIES$ resolves to TORONTO

Working with global variables

Longview provides you with several global variables to use when creating Longview Apps. Unlike system variables, App Developers can set the value of global variables. Longview Application Framework or Longview Apps can use the values to which these global variables are set to trigger an action or behavior such as displaying a visual warning indicator.

The following global variables can be used in Longview Application Framework documents:

Using the LVG_FormValid global variable

This variable returns custom validation logic. For each control in a Longview Form, you can optionally specify an OnChange procedure to run each time an input value changes. If LVG_FormValid is set to 0, the input item that triggered the OnChange procedure is considered invalid. A visual indicator appears to the user to indicate the invalid control. You can optionally specify a customizable validation message to display using the LVG_FormMessage.

For more information on OnChange, see Using the OnChange Keyword.

Syntax example

Show Message "Checking your email address..." continue

If StrContains ("$sEmail$", "@")

Set Variable LVG_FormValid = 1

Else

Set Variable LVG_FormValid = 0

Set Variable LVG_FormMessage = "Your email address must include the @ sign."

End if

Using the LVG_FormMessage global variable

This variable returns a customizable message to a user after a form is validated. You can use this variable in conjunction with the LVG_FormValid global variable to display a message to a user when an input item is considered invalid.

Syntax example

Set Variable LVG_FormMessage = "Your email address must include the @ sign."

Using the LVG_TableRedraw global variable

This variable returns custom redraw logic for a Table. After a dynamic procedure is run on a Table, there may be instances where the row needs to be redrawn or the entire table needs to be redrawn to reflect changed values. There are also instances where a redraw is not needed.

You can optionally specify the redraw logic by setting the LVG_TableRedraw global variable to one of the following:

Variable Description

NONE

To indicate that no part of the table should be redrawn.

ROW

To indicate the current row should be redrawn.

TABLE

To indicates the entire table should be redrawn.

Note: The default value for LVG_TableRedraw is Row.

For more information on Dynamic Procedures, see Exclusive.

Syntax example

If ("$C_CONTEXT$" == "DYNAMICCELLEDIT")

RUN PROCEDURE “RecalcInventory.lvpro”

Set VARIABLE LVG_TableReDraw = "TABLE"

Else

Set VARIABLE LVG_TableReDraw = "NONE"

End If

Working with event variables

Longview provides you with several event variables populated with event-related information. When an event is triggered, the event variables are populated with the corresponding symbols that triggered the event. There is one event variable for each dimension in the system.

For example, $E_ACCOUNTS$ resolves to "AnnualSalary" or $E_TIMEPERIODS$ resolves to "April."

Note: Event variables are supported for base dimensions only; event variables are not supported for schedule dimensions.

The names of the variables in Longview Application Framework to be used in these event variables are limited to 31 characters. The convention is E_Dimension (where Dimension is the first 26 characters of the dimension name).

In the case where the first 26 characters of the dimension names are the same, the variables are named E_Dimension_N (where Dimension is the first 26 characters of the dimension, and N is the dimension number).

Using the LVS_EVENTERRORFILES variable

This variable stores the location of where error files are generated for events, as specified by the data server configuration parameter Events Error Files Location. You may use this variable in an event procedure. If this parameter has not been defined in the data server configuration, the value will be an empty string.

Syntax example

CREATE Variable slvs_EventErrors as String

Set Variable slvs_EventErrors = $LVS_EVENTERRORFILES$

Using the LVS_EVENTHISTORYFILES variable

This variable stores the location of where history files are generated for events, as specified by the data server configuration parameter Events History Files Location. You may use this variable in an event procedure. If this parameter has not been defined in the data server configuration, the value will be an empty string.

Syntax example

CREATE Variable slvs_EventHistory as String

Set Variable slvs_EventHistory = $LVS_EVENTHISTORYFILES$

Using the LVS_EVENTLOGFILES variable

This variable stores the location of where log files are generated for events, as specified by the data server configuration parameter Event Log Files Location. You may use this variable in an event procedure. If this parameter has not been defined in the data server configuration, the value will be an empty string.

Syntax example

CREATE Variable slvs_EventLogs as String

Set Variable slvs_EventLogs = $LVS_EVENTLOGFILES$

Working with symbol specifications

Symbol specifications are used in numerous instances in retrieving information about symbols and the data they contain. In situations where you are querying data, the following specifications are possible:

Specification Meaning

symbol###

all leaf symbols under symbol, unless the symbol is a leaf then it will just return the specified symbol

symbol#n

all symbols under symbol, n levels down, including symbol

symbol##n

all parent symbols under symbol, n levels down

symbol##+n

all parent symbols under symbol, n levels down, including symbol

symbol#*

all roots of symbol

symbol#-n

all symbols exactly n levels down from symbol

symbol##^n

all ancestors of symbol that are n levels above symbol, including symbol

symbol##^n:root

all symbols above symbol, n levels up, under root, and including symbol, where root is the root symbol (e.g., BALSHEET##^2:TRIALBAL)

Data Grid functions that support symbol specifications include:

Data Table functions that support symbol specifications include:

Using conditional operators

Conditional operators enable you to specify the desired relationship between values in the database or DataAreas and to create instructions based on whether or not the conditions they define exist. They are crucial in processes involving the use of the If commands or functions.

Valid conditional operators in Longview Application Framework include the following:

Symbol Meaning

NE or !=

is not equal to

EQ or ==

is exactly equal to

GT or >

is greater than

GE or >=

is greater than or equal to

LT or <

is less than

LE or <=

is less than or equal to

Setting values in Longview Application Framework

When you set values in Longview Application Framework commands, functions, etc., double quotation marks enclosing the values may be recommended or mandatory. Follow these rules:

Value Double Quotation Marks? Example

Empty, or null value

Required

""

Space(s)

Required

""

Space anywhere in the value (leading, embedded, trailing)

Required

"John Smith"

No spaces

Optional

3681559 or "3681559"

Using tokens, variables, and strings

You can use tokens, variables, and strings to customize certain aspects of your code. Tokens are resolved and variables are evaluated dynamically at the time of execution. As a Developer, you can insert tokens into code, usually in place of strings or text.

Attribute tokens

You can use a token to retrieve attribute values, such as the description for a user or symbol, or the user’s email address. Use a “[[ ]]” pair to identify the presence of a token.

Syntax

[[AttrClass,AttrName,ObjectName]]

where:

  • AttrClass is the attribute class. Type one of the following:
    Value Description

    SYSTEM

    Use this class for system attributes.

    SYMBOL

    Use this class for symbol attributes.

    USER

    Use this class for user attributes.

  • AttrName is the attribute name. Type one of the following:
    Value Description

    DESCRIPTION

    For symbol and user attributes, use this attribute name to retrieve the symbol or user’s description.

    EMAIL

    For user attributes, use this attribute name to retrieve the user’s email address.

  • ObjectName is the attribute object. Type one of the following:
    Attribute Type Use…

    SYSTEM

    DBDefault

    SYMBOL

    The symbol name

    USER

    The user ID or THIS for the current user

Syntax example

[[SYMBOL,DESCRIPTION,A40000]]

[[SYSTEM,ASCalendarYr,DBDefault]]

[[USER,EMAIL,BSummers]]

Resource Tokens

You can use a token to retrieve resource strings from a resource bundle residing on the Longview Data Server. The resource bundle must be loaded into memory before using this token.

Use a “[[ ]]” pair to identify the presence of a token. You may find these tokens useful when creating Longview Apps that need to be supported for multiple languages. You may use this token in various documents such as: Longview Forms, Longview Table Views, Longview Data Views, Longview Procedures, and Longview DataAreaSpecs.

The language and culture of the operating system (OS), along with the name of the resource bundle determines how the resource key lookup is performed.

The names of resource bundles can be one of the following formats:

Order of Lookup Name of resource Example

1

resourceBundle.Language-Culture.extension

Strings.en-CA.lvres

2

resourceBundle.Language.extension

Strings.en.lvres

3

resourceBundle.extension

Strings.lvres

For example, for an OS that is en-CA (English language, Canada culture), the look up will occur in the following files in the following order:

  • Strings.en-CA.lvres
  • Strings.en.lvres
  • Strings.lvres

By organizing resources properly, you can develop Longview Apps that will support multiple languages.

Syntax example

[[RESOURCE, "resourceBundle", "resourceKey"]]

where:

  • resourceBundle is the name of the resource bundle.
  • resourceKey is the name of the resource key.

Sample format of resource file

Syntax example 1

// Using a resource token in a Button in a Longview Form

Button "Update", "Text:[[RESOURCE, "Messages", "UpdateHeading"]] ", Validate:TRUE, "OnClick:button.lvpro"

Syntax example 2

// Using a resource token (with variables) in a Toolbar Action in a Longview Data View

ACTION "[[RESOURCE, "$source$", "$resourceKey$]]" ", "Image.png", "RUN PROCEDURE MyProc.lvpro", "This is help text"

Syntax example 3

// Using a resource token (with variables) in a SHOW MESSAGE command

SHOW MESSAGE "[[RESOURCE, "$source$", "$resourceKey$"]] "

Variables

A variable is a placeholder for dynamic data. There are different types of variables to support the storage of a single string value or list of string values, a single numeric value or list of numeric values, a list of symbol names, and a single object instance or list of object instances. You must first create your variable using the Create Variable command, assign a value to your variable using the Set Variable command, and then enclose your variable in $ $ to retrieve the value.

For object type variables, you can also assign values to its properties by using the Create Property command, followed by the Set Property command.

For more information on creating variables, see Create Variable.

For information on creating variables that you can use within any model or procedure called from your main procedure, see Create GlobalVariable.

In Longview Apps, you can pass variables between Longview Procedure and HTML documents by prefixing your variable with “LV_” in your HTML document.

For more information, see Passing variables between Longview Apps and Longview Application Framework.

Syntax example 1: For your Longview Apps procedure file

Create Variable EmpName as String Set Variable EmpName = “John Doe”

Show Message “Welcome $EmpName$!”

Syntax example 2: For your Longview Apps HTML file

<input id=“LV_EmpName” name=“EmpName” type=“text” /input>

Strings

Strings can be joined together through a process called concatenation. Concatenation is useful for joining two individual values to create combined values, or two-character strings to create a symbol name.

For example, suppose a complete account number in your system appears in the format A11234—consisting of a prefix code (A), followed by two digits (11) representing an entity code, followed by three digits (234) representing an account code.

You can combine any two of the elements by concatenating them. The concatenation provided by your system depends on the format of the source items:

Format of Sources Value of TargetSymName

If either of the sources contains a numeric value

Numeric source not used in concatenation.

If both sources contain numeric values

Resulting string remains unchanged.

Syntax

STRING 1 + STRING 2

Syntax example

CREATE VARIABLE StrTemp1 AS STRING

SET VARIABLE StrTemp1 = "aaaaa" + "bbbbb"

StrTemp1 will equal "aaaaabbbbb" (without the double quotation marks)

Published:

Overview Of Longview Application Framework

Longview Application Framework is the interface used for developing custom business logic within your Longview system.

Longview Application Framework performs the following tasks:

  1. Handles interaction between the Longview Server and an already-deployed Longview App through the Longview API layer.
  2. Can be run directly from a command prompt in batch mode, and permits the scheduling of tasks via third-party software.

In this section, you can find information on the following topics:

Syntax with connection parameters

To run Longview Application Framework in batch mode, the executable file (lv_af.exe) requires the following syntax:

lv_af User/Password Host Port LID V3_COMPATIBLE_ACCESS Group Proc [LanguageCode] [Param=Value]

where:

  • User/Password is the Data Server user name and password. If using Windows authentication, use "/".
  • Host is the host machine of the Data Server.
  • Port is the listener port number of the Data Server.
  • LID is the Longview Identifier of the Data Server.
  • Group is the name of a user group.
  • Proc is the name of the Procedure document to run, or the path of the Procedure document if it is in a different directory. The Procedure document must be a text file, and the file name can have any extension.
  • LanguageCode is the optional language code, with a default value of EN.
  • Param is optional and is the variable to which to pass the value. You can pass more than one parameter as long as the variable is unique.
  • Value is the value to pass to the related Param.

Note: You must enclose values that contain spaces or Windows Command Shell special characters, such as ampersands ( & ), pipes ( | ), and parentheses, in double quotation marks.

Example 1: Code

lv_af Admin/Admin1 e3000 20001 lv34 default proccopy.txt EN

Example 2: Code

lv_af Admin/Admin1 e3000 20001 lvProd V3_COMPATIBLE_ACCESS Administrators proccopy.txt EN Entities=TCANADA

Example 3: Code

lv_af Admin/Admin1 e3000 20001 lvProd V3_COMPATIBLE_ACCESS Administrators proccopy.txt EN Entities="Total Canada"

Example 4: Code

lv_af Admin/Admin1 e3000 20001 lvProd V3_COMPATIBLE_ACCESS Administrators proccopy.txt EN Entities="Canada|USA"

Syntax with connection parameters in Procedure document

lv_af Proc [Param=Value]

where:

  • Proc is the text file that contains the commands or documents to execute or call, including connection parameters. This may include a command or an action to call or invoke another document.
  • Param is optional and is the variable to which to pass the value. You can pass more than one parameter as long as the variable is unique.
  • Value is the value to pass to the related Param.

Issuing commands

Longview Application Framework can be called from a System Administrator’s computer, using the command prompt.

Commands and documents are available in Longview Application Framework. Commands may execute actions or call documents, which may invoke further commands. Documents are ASCII text files that outline parameters for actions, or additional actions to take.

The interface does not currently provide a Graphical User Interface (GUI)—it is command-line based. All parameter values are non-case sensitive.

Batch Mode syntax

To run Longview Application Framework in batch mode, the executable file (lv_af.exe) requires the following syntax:

lv_af Script

lv_af User/Password Host Port DSID AccessRole Script [LanguageCode]

For more information on calling commands from Longview Application Framework documents, see Understanding document types.

Understanding document types

A Longview Application Framework document is a text-based file containing instructions for Longview Application Framework. To ensure that all commands, functions, and Models invoked within your documents work as desired, you should save your Longview Application Framework documents as ASCII files rather than as Windows ASCII binary files.

Longview Application Framework has several types of documents used for different purposes. All Longview Application Framework documents can be run by users in batch mode, from a command prompt.

Caution: The use of the asterisk as a multiplication symbol in the application requires that it be enclosed in double quotation marks ("*"). An asterisk without double quotation marks is interpreted by the system as a wildcard search character, and operations that include it will not give the expected results.

Conforming to file extension conventions

Longview recommends that you follow standard naming conventions when you create Longview Application Framework documents.

Document type Recommended Extension Applies to…

Longview App Configuration File

lvapp

Longview Smart Client

DataArea Spec

lvdsp

Longview Smart Client

Longview Application Framework

DataView definition

lvdvw

Longview Smart Client

DataTable definition

lvdtd

Longview Smart Client

Table View definition

lvtvw

Longview Smart Client

Calendar View definition

lvcvw

Longview Smart Client

Form document

lvfrm

Longview Smart Client

ImportSpec

lvimp

Longview Smart Client

Longview Application Framework

ExportSpec

lvexp

Longview Smart Client

Longview Application Framework

CalculatedJESpec

lvcje

Longview Application Framework

Symbol Map

lvmap

Longview Smart Client

Longview Application Framework

Model

lvmod

Longview Smart Client

Longview Application Framework

Procedure

lvpro

Longview Smart Client

Longview Application Framework

Subroutine

lvsub

Longview Smart Client

Longview Application Framework

UI

lvui

Longview Smart Client

HTML

html

Longview Smart Client

Conforming to naming conventions

For some commands and functions, you create a certain item in Longview, such as a document or symbol, and apply an appropriate name. Make sure your system can use the names you specify.

Symbol names

To create a valid symbol name, follow these guidelines:

  • Symbol names can contain only letters, numbers, periods ( . ), and underscores ( _ ); do not use spaces, other punctuation, or other special characters.
  • Symbol names cannot contain more than 31 characters.
  • Symbol names must be unique in the system.

Note: Numeric symbol names must be prefixed by the exclamation point character “!” when used in a Model or equation. For example !22342 identifies 22342 as a symbol name and not a numeric value.

Symbol descriptions

Symbol descriptions can contain a maximum of 100 characters.

Symbol hierarchies

Symbols are usually grouped together in relationships called parent, child, and leaf symbols.

Symbol Type Description

Parent

A parent is any symbol under which other symbols are grouped. It is possible for a symbol to be both a parent symbol

Child

A child is any symbol grouped under another symbol. It is possible for a child symbol to itself be the parent symbol for another child symbol or symbols, as well as the child of another parent symbol.

Leaf

A leaf is any symbol with no child symbols grouped under it, regardless of how many levels deep in the hierarchy it resides.

Root

A root symbol resides in the first level of the hierarchy and does not have a parent symbol. It is possible for a root symbol to be the parent symbol of another symbol or symbols.

Symbol hierarchy is central in Longview applications to displaying the relationships between symbols and how their values relate to one another.

Rollup Indicator Meaning

+

The child symbol’s value is added to the parent symbol’s value.

-

The child symbol’s value is subtracted from the parent symbol’s value.

0

The child symbol’s value does not alter the value of the parent symbol.

User IDs

The requirements for user IDs depends on the authentication method used by your company.

User descriptions

A user description is usually the full name of the user. User descriptions can contain a maximum of 100 characters.

A user ID must follow these guidelines:

Authentication Guidelines

Longview authentication

If your company uses Longview authentication, follow these guidelines for user IDs:

  • may include maximum of 63 characters
  • may include any number, and any letter, uppercase or lowercase
  • may contain spaces anywhere within the name, but not at the very end
  • may include the following special characters: # _ ! ~ ‘ and .
  • cannot include any other special characters, such as the backslash ( \ )

Windows authentication

If your company uses Windows authentication, use the user’s

Windows user ID, following these guidelines:

  • must include the domain name, a backslash, and the Windows user ID; for example: CONNECT \ Host Port LID [Group]
  • may include the following special characters: # _ ! ~ ‘ and .
  • cannot include any other special characters

Working with system variables

Longview provides you with several system variables to store commonly used system information. For example, you can use the ExportVariable function with system variables to export the information stored in the variable to a file. You can also use the Show Message command with system variables to display the information stored in the variable in a message window when you are creating Longview Apps.

The following system variables can be used in Procedures, Model, and Data View documents.

Using the LVS_BATCH_IDS system variable

This variable stores the batch IDs of the latest batches that result from any of the following commands and functions:

Note: When using LVS_BATCH_IDS in conjunction with JournalEntryPost() and JournalEntryUnpost() functions, only the last batch ID is returned.
Therefore, you should poll the LVS_BATCH_IDS value after each JournalEntryPost() and JournalEntryUnpost() action in order to retrieve the appropriate batch ID.

Syntax example

Create Variable slvs_Batch_IDS[] as String

Set Variable slvs_Batch_IDS[] = STRREPLACE( "$LVS_BATCH_IDS$", "@", "|" )

Using the LVS_BLUR_ID system variable

This variable stores the label of the tab in a Data Grid that has lost focus after a user switches from one tab to another in a tabbed Data Grid.

Syntax example

Create Variable slvs_Blur_ID as String

Set Variable slvs_Blur_ID = "The $LVS_BLUR_ID$ tab has lost focus" Show Message "$slvs_Blur_ID$"

Using the LVS_BUTTONCLICKED system variable

This variable stores a user’s button selection such as OK or Cancel, for example, in a dialog using the ShowFileChooser or ShowSymbolSelector function.

Syntax example

Create Variable slvs_ButtonClicked as String

Set Variable slvs_ButtonClicked = $LVS_BUTTONCLICKED$

Using the LVS_ERRORCODE system variable

If the system encounters an error, the error code is stored in this variable.

Syntax example

Create Variable nlvs_ErrorCode as Num

Set Variable nlvs_ErrorCode = $LVS_ERRORCODE$

Using the LVS_ERRORMESSAGE system variable

If the system encounters an error, the error message is stored in this variable.

Syntax example

Create Variable slvs_ErrorMessage as String

Set Variable slvs_ErrorMessage = $LVS_ERRORMESSAGE$

Using the LVS_EVENT_ID system variable

This variable stores the event IDs of the current process. If the process has not started as a result of an event, the value returned is -1.

Syntax example

Create Variable nlvs_Event_ID as Num

Set Variable nlvs_Event_ID = $LVS_EVENT_ID$

Using the LVS_FETCHINDEX system variable

Use this variable to retrieve the row index of the currently fetched row in the cursor. You could use this variable in conjunction with the SetDataTableCell function to, for example, update an existing value with a new value.

Syntax example

Set Variable nResult = SetDataTableCell (myDataTable, $LVS_FETCHINDEX$, $colIndex$,

$newSalary$)

Using the LVS_FETCHSTATUS system variable

Use this variable to retrieve the status of the Fetch command.

This variable is set to one of the following values, depending on the outcome of the Fetch command:

  • 0—The Fetch command was successful, and a string is stored in the relevant variable.
  • -1—The Fetch command was unsuccessful (the cursor moved past the result).
  • -2—The Fetch command was unsuccessful (the result is marked as deleted or ignored). This could occur when a row has been deleted through the user interface, but the changes have not yet been submitted.

Syntax example

If $LVS_FetchStatus$ EQ 0

Run Model TransferTableData.lvmod

End If

Using the LVS_FILESCUSTOMROOTPATH system variable

This variable stores the path of the Files Custom Root Folder.

Syntax example

Create Variable sFilesCustomRootPath as String

Set Variable sFilesCustomRootPath = "The Files Custom Root Path is $LVS_FILESCUSTOMROOTPATH$"

Show Message “$sFilesCustomRootPath$”

Using the LVS_FOCUS_ID system variable

This variable stores the label of the tab in a Data Grid that has gained focus after a user switches from one tab to another in a tabbed Data Grid.

Syntax example

Create Variable slvs_Focus_ID as String

Set Variable slvs_Focus_ID = "The $LVS_FOCUS_ID$ tab has gained focus"

Show Message "$slvs_Focus_ID$"

Using the LVS_HTTPPROTOCOL system variable

This variable stores the type of http protocol. Possible return values are HTTP and HTTPS.

Syntax example

Create VARIABLE sHttpProtocol as String

Set VARIABLE sHttpProtocol = "The Http Protocol is: $LVS_HTTPPROTOCOL$"

Show Message "$sHttpProtocol$"

Using the LVS_IDENTIFIER system variable

This variable stores the Longview Identifier of the system.

Syntax example

Create Variable slvs_Identifier as String

Set Variable slvs_Identifier = "The Identifier is: $LVS_IDENTIFIER$"

Show Message "$slvs_Identifier$"

Using the LVS_LANGCODE system variable

This variable stores the language code of the system. Possible return values are EN and FR.

Syntax example

Create VARIABLE sLangCode as String

Set VARIABLE sLangCode = "The Language code is: $LVS_LANGCODE$"

Show Message "$sLangCode$"

Using the LVS_LISTDELIMITER system variable

This variable stores the delimiter for STRING and NUM list variables in the current instance, as set by the UseListDelimiter command.

Syntax example

Create Variable slvs_ListDelimiter as String

Set Variable slvs_ListDelimiter = "$LVS_LISTDELIMITER$"

Using the LVS_RDBMS system variable

This variable stores the current database type (SQL or ORACLE).

Syntax example

Create Variable slvs_RDBMS as String

Set Variable slvs_RDBMS = $LVS_RDBMS$

Using the LVS_SESSIONID system variable

This variable stores the current session ID.

Syntax example

Create VARIABLE sSessionID as String

Set VARIABLE sSessionID = "The session ID is: $LVS_SessionID$"

Show Message "$sSessionID$"

Using the LVS_USERID system variable

This variable stores the username of the current user.

Syntax example

Create Variable slvs_UserID as String

Set Variable slvs_UserID = "Hello $LVS_USERID$"

Show Message "$slvs_UserID$"

Using the LVS_USERGROUP system variable

This variable stores the user group of the current user.

Syntax example

Create Variable slvs_UserGroup as String

Set Variable slvs_UserGroup = "Current user is in the $LVS_USERGROUP$ user group"

Show Message "$slvs_UserGroup$"

Using the LVS_WEBBRIDGE system variable

This variable stores the path and file for the .cgi or .dll bridge file for the web bridge, such as "/cgi-bin/LID/lvweb.cgi", where LID is the Longview Identifier for the system.

Syntax example

Create VARIABLE sWebBridge as String

Set VARIABLE sWebBridge = "The web bridge is: $LVS_WebBridge$"

Show Message "$sWebBridge$"

Using the LVS_WEBBRIDGEPATH system variable

This variable stores the path for the .cgi or .dll bridge file for the web bridge, such as "/cgi-bin/LID/", where LID is the Longview Identifier for the system.

Syntax example

Create VARIABLE sWebBridgePath as String

Set VARIABLE sWebBridgePath = "The web bridge path is: $LVS_WebBridgePath$"

Show Message "$sWebBridgePath$"

Using the LVS_WEBSERVER system variable

This variable stores the web server, such as ca127dev12.

Syntax example

Create VARIABLE sWebServer as String

Set VARIABLE sWebServer = "The web server is: $LVS_WebServer$"

Show Message "$sWebServer$"

Working with system variables for persistent event rules

Longview provides you with the LVS_EVENTINITIALIZE, LVS_EVENTSHUTDOWN, and LVS_PERSISTENT system variables, which are used in conjunction with persistent event rules. A single Management Server process is launched to handle persistent events in the following scenarios:

  • when the server is started
  • if maintenance is turned off
  • if application framework is disconnected and a persistent event rule is triggered

The Management Server process remains in the system until the data server is shut down, in order to handle each successive triggering of the persistent event. For more information on persistent event rules, see the Longview Application Administrator Guide.

Note: If you make any changes to the list of persistent event rules (in either the Persistent Event Rule Setup dialog, or the rulepersists.txt file) or the name of the procedure launched by the persistent event rules, you must restart the servers for your changes to take effect.

Using the LVS_EVENTINITIALIZE system variable

This variable indicates if the current process is run as a result of the Management Server starting, or not. While the servers are starting, the corresponding event procedure is run.

You can use this variable within the event procedure to define what to run upon initialization. This variable should be used to ensure that the actual calculation is not run when the event procedure is run as a result of the Management Server starting.

For instance, (in the Persistence syntax example) if the servers are starting, the LVS_EVENTINITIALIZE variable indicates that the create persistent lock procedure should be run.

Using the LVS_EVENTSHUTDOWN system variable

This variable indicates if the current process is run as a result of the Management Server stopping, or not. While the servers are stopping, the corresponding event procedure is run.

You can use this variable within the event procedure to define what to run upon shutdown. This variable should be used to ensure that the actual calculation is not run when the event procedure is run as a result of the Management Server stop- ping.

For instance (in the Persistence syntax example), if the servers are stopping, the LVS_EVENTSHUTDOWN variable indicates that the delete persistent lock procedure should be run.

Using the LVS_PERSISTENT system variable

This variable indicates if the current process is persistent or not. When an event is triggered, the corresponding event procedure is run. You can use this variable within the event procedure to define what to run for a persistent event. This variable should be used to ensure that commands that connect to and disconnect from Application Framework are not run when the event is a persistent event.

For instance (in the Persistence syntax example), in cases where the current process is not persistent, the LVS_PERSISTENT variable indicates that locks for event rule processes that are not persistent should be created and deleted.

Persistence syntax example

syntax

If $LVS_EventInitialize$ AND $LVS_Persistent$

// create persistent lock

Create LOCK USER using "bigdataspec.lvdsp"

Else

If $LVS_EventShutDown$ AND $LVS_Persistent$

// delete persistent lock

Delete LOCK USER using "bigdataspec.lvdsp"

Else

If Not $LVS_Persistent$

// create lock if persistence not used

Create LOCK USER using "smalldataspec.lvdsp"

END If

// create and download data area

Create DATAAREA da using "smalldataspec.lvdsp" Download da

// run model

Run MODEL "calc.lvmod" on da

// upload data area Upload da

If Not $LVS_Persistent$

// delete lock if persistence not used

Delete LOCK USER using "smalldataspec.lvdsp"

END If

END If

END If

Working with context variables

Longview provides you with several context variables populated with App context- related information. When a user right-clicks a cell or clicks a toolbar button in a Data Grid or a Table, an action is triggered, and specific context variables are populated.

The following context variables can be used in Longview Application Framework documents:

Variable Returns… Example

C_CONTEXT
(for Data Grids)

a user’s click selection in a Data Grid. If the user clicks a cell, the return value is CELL. If the user clicks a toolbar action, the return value is DATAGRID.

$C_CONTEXT$ resolves to CELL or $C_CONTEXT$ resolves to DATAGRID

C_CONTEXT
(for Tables)

  • If the user right-clicks on the row header, the return value is ROW.
  • If the user clicks a toolbar action, the return value is TABLE.
  • If the user manually edits data in a cell or edits data using a UI control, the return value is DYNAMICCELLEDIT.
  • If the user invokes the standard row operation Add, the return value is DYNAMICADD.
  • If the user invokes the standard row operation Duplicate, the return value is DYNAMICDUPLICATE.
  • If the user invokes the standard row operation Delete, the return value is DYNAMICDELETE.
  • If the user invokes the standard row operation Edit, the return value is DYNAMICEDIT.
  • If the user invokes the standard row operation Reset, the return value is DYNAMICRESET.
  • If the user invokes the standard row operation Reset All, the return value is DYNAMICRESETALL.
  • If the user pastes multiple values into a table, when pasting the first value and subsequent values (except the last value), the return value is BEGINMULTI- PASTE.
  • If the user pastes multiple values into a table, when pasting the last value, the return value is ENDMULTIPASTE.

$C_CONTEXT$ resolves to ROW or TABLE

C_DATAAREA

the name of the related data area.

$C_DATAAREA$ resolves to SampleDA

C_DATATABLE
(for Tables)

the name of the Data Table object.

$C_DATATABLE$ resolves to SampleDT

C_CELLVALUE
(for Data Grids)

the value of the intersection after a user right-clicks a cell in a Data Grid. This variable is not populated for toolbar actions.

$C_CELLVALUE$ resolves to 200

C_CELLVALUE
(for Tables)

the value of the intersection of an edited cell in a Table. This variable is not populated for toolbar actions or row context actions.

$C_CELLVALUE$ resolves to 200
C_CELLVALUE
PRIOR
(for Tables)

the previous value of the intersection after a user has edited a cell in a Data Table. This variable is not populated for toolbar actions or row context actions.

$C_CELLVALUEPRIOR $ resolves to 100

C_ROWINDEX

the number of the corresponding row index in the Data Table object in which the user has right clicked. If C_CONTEXT resolves to TABLE, this variable resolves to 0.

$C_ROWINDEX$ resolves to 2

C_ROWS

the dimension in the rows orientation of the Data Grid. If the Data Grid has nested dimensions in the rows orientation, the variable returns the dimensions in order from outer to inner.

$C_ROWS$ resolves to ENTITIES, ACCOUNTS

C_SOURCE
ROWINDEX

the number of the corresponding row index in the Data Table Object that the user has duplicated.

$C_SOURCEROWINDEX$ resolves to 1 when the first row in the table is duplicated

C_COLUMNS

the dimension in the column orientation of the Data Grid. If the Data Grid has nested dimensions in the columns orientation, the variable returns the dimensions in order from outer to inner.

$C_COLUMNS$ resolves to TIMEPER

C_DIMENSION

the name of the symbol for each dimension at the intersection that the user right clicked. For toolbar actions, these variables are populated only for dimensions that are not in the rows or columns orientation. The names of the variables in Longview Application Framework to be used in these context variables are limited to 31 characters. The convention is C_DIMENSION (where DIMENSION is the first 26 characters of the dimension name). In the case where the first 26 characters of the dimension names are the same, the variables are named C_DIMENSION_N (where DIMENSION is the first 26 characters of the dimension, and N is the dimension number).

$C_CURRENCIES$ resolves to CAD or $C_ENTITIES$ resolves to TORONTO

Working with global variables

Longview provides you with several global variables to use when creating Longview Apps. Unlike system variables, App Developers can set the value of global variables. Longview Application Framework or Longview Apps can use the values to which these global variables are set to trigger an action or behavior such as displaying a visual warning indicator.

The following global variables can be used in Longview Application Framework documents:

Using the LVG_FormValid global variable

This variable returns custom validation logic. For each control in a Longview Form, you can optionally specify an OnChange procedure to run each time an input value changes. If LVG_FormValid is set to 0, the input item that triggered the OnChange procedure is considered invalid. A visual indicator appears to the user to indicate the invalid control. You can optionally specify a customizable validation message to display using the LVG_FormMessage.

For more information on OnChange, see Using the OnChange Keyword.

Syntax example

Show Message "Checking your email address..." continue

If StrContains ("$sEmail$", "@")

Set Variable LVG_FormValid = 1

Else

Set Variable LVG_FormValid = 0

Set Variable LVG_FormMessage = "Your email address must include the @ sign."

End if

Using the LVG_FormMessage global variable

This variable returns a customizable message to a user after a form is validated. You can use this variable in conjunction with the LVG_FormValid global variable to display a message to a user when an input item is considered invalid.

Syntax example

Set Variable LVG_FormMessage = "Your email address must include the @ sign."

Using the LVG_TableRedraw global variable

This variable returns custom redraw logic for a Table. After a dynamic procedure is run on a Table, there may be instances where the row needs to be redrawn or the entire table needs to be redrawn to reflect changed values. There are also instances where a redraw is not needed.

You can optionally specify the redraw logic by setting the LVG_TableRedraw global variable to one of the following:

Variable Description

NONE

To indicate that no part of the table should be redrawn.

ROW

To indicate the current row should be redrawn.

TABLE

To indicates the entire table should be redrawn.

Note: The default value for LVG_TableRedraw is Row.

For more information on Dynamic Procedures, see Exclusive.

Syntax example

If ("$C_CONTEXT$" == "DYNAMICCELLEDIT")

RUN PROCEDURE “RecalcInventory.lvpro”

Set VARIABLE LVG_TableReDraw = "TABLE"

Else

Set VARIABLE LVG_TableReDraw = "NONE"

End If

Working with event variables

Longview provides you with several event variables populated with event-related information. When an event is triggered, the event variables are populated with the corresponding symbols that triggered the event. There is one event variable for each dimension in the system.

For example, $E_ACCOUNTS$ resolves to "AnnualSalary" or $E_TIMEPERIODS$ resolves to "April."

Note: Event variables are supported for base dimensions only; event variables are not supported for schedule dimensions.

The names of the variables in Longview Application Framework to be used in these event variables are limited to 31 characters. The convention is E_Dimension (where Dimension is the first 26 characters of the dimension name).

In the case where the first 26 characters of the dimension names are the same, the variables are named E_Dimension_N (where Dimension is the first 26 characters of the dimension, and N is the dimension number).

Using the LVS_EVENTERRORFILES variable

This variable stores the location of where error files are generated for events, as specified by the data server configuration parameter Events Error Files Location. You may use this variable in an event procedure. If this parameter has not been defined in the data server configuration, the value will be an empty string.

Syntax example

CREATE Variable slvs_EventErrors as String

Set Variable slvs_EventErrors = $LVS_EVENTERRORFILES$

Using the LVS_EVENTHISTORYFILES variable

This variable stores the location of where history files are generated for events, as specified by the data server configuration parameter Events History Files Location. You may use this variable in an event procedure. If this parameter has not been defined in the data server configuration, the value will be an empty string.

Syntax example

CREATE Variable slvs_EventHistory as String

Set Variable slvs_EventHistory = $LVS_EVENTHISTORYFILES$

Using the LVS_EVENTLOGFILES variable

This variable stores the location of where log files are generated for events, as specified by the data server configuration parameter Event Log Files Location. You may use this variable in an event procedure. If this parameter has not been defined in the data server configuration, the value will be an empty string.

Syntax example

CREATE Variable slvs_EventLogs as String

Set Variable slvs_EventLogs = $LVS_EVENTLOGFILES$

Working with symbol specifications

Symbol specifications are used in numerous instances in retrieving information about symbols and the data they contain. In situations where you are querying data, the following specifications are possible:

Specification Meaning

symbol###

all leaf symbols under symbol, unless the symbol is a leaf then it will just return the specified symbol

symbol#n

all symbols under symbol, n levels down, including symbol

symbol##n

all parent symbols under symbol, n levels down

symbol##+n

all parent symbols under symbol, n levels down, including symbol

symbol#*

all roots of symbol

symbol#-n

all symbols exactly n levels down from symbol

symbol##^n

all ancestors of symbol that are n levels above symbol, including symbol

symbol##^n:root

all symbols above symbol, n levels up, under root, and including symbol, where root is the root symbol (e.g., BALSHEET##^2:TRIALBAL)

Data Grid functions that support symbol specifications include:

Data Table functions that support symbol specifications include:

Using conditional operators

Conditional operators enable you to specify the desired relationship between values in the database or DataAreas and to create instructions based on whether or not the conditions they define exist. They are crucial in processes involving the use of the If commands or functions.

Valid conditional operators in Longview Application Framework include the following:

Symbol Meaning

NE or !=

is not equal to

EQ or ==

is exactly equal to

GT or >

is greater than

GE or >=

is greater than or equal to

LT or <

is less than

LE or <=

is less than or equal to

Setting values in Longview Application Framework

When you set values in Longview Application Framework commands, functions, etc., double quotation marks enclosing the values may be recommended or mandatory. Follow these rules:

Value Double Quotation Marks? Example

Empty, or null value

Required

""

Space(s)

Required

""

Space anywhere in the value (leading, embedded, trailing)

Required

"John Smith"

No spaces

Optional

3681559 or "3681559"

Using tokens, variables, and strings

You can use tokens, variables, and strings to customize certain aspects of your code. Tokens are resolved and variables are evaluated dynamically at the time of execution. As a Developer, you can insert tokens into code, usually in place of strings or text.

Attribute tokens

You can use a token to retrieve attribute values, such as the description for a user or symbol, or the user’s email address. Use a “[[ ]]” pair to identify the presence of a token.

Syntax

[[AttrClass,AttrName,ObjectName]]

where:

  • AttrClass is the attribute class. Type one of the following:
    Value Description

    SYSTEM

    Use this class for system attributes.

    SYMBOL

    Use this class for symbol attributes.

    USER

    Use this class for user attributes.

  • AttrName is the attribute name. Type one of the following:
    Value Description

    DESCRIPTION

    For symbol and user attributes, use this attribute name to retrieve the symbol or user’s description.

    EMAIL

    For user attributes, use this attribute name to retrieve the user’s email address.

  • ObjectName is the attribute object. Type one of the following:
    Attribute Type Use…

    SYSTEM

    DBDefault

    SYMBOL

    The symbol name

    USER

    The user ID or THIS for the current user

Syntax example

[[SYMBOL,DESCRIPTION,A40000]]

[[SYSTEM,ASCalendarYr,DBDefault]]

[[USER,EMAIL,BSummers]]

Resource Tokens

You can use a token to retrieve resource strings from a resource bundle residing on the Longview Data Server. The resource bundle must be loaded into memory before using this token.

Use a “[[ ]]” pair to identify the presence of a token. You may find these tokens useful when creating Longview Apps that need to be supported for multiple languages. You may use this token in various documents such as: Longview Forms, Longview Table Views, Longview Data Views, Longview Procedures, and Longview DataAreaSpecs.

The language and culture of the operating system (OS), along with the name of the resource bundle determines how the resource key lookup is performed.

The names of resource bundles can be one of the following formats:

Order of Lookup Name of resource Example

1

resourceBundle.Language-Culture.extension

Strings.en-CA.lvres

2

resourceBundle.Language.extension

Strings.en.lvres

3

resourceBundle.extension

Strings.lvres

For example, for an OS that is en-CA (English language, Canada culture), the look up will occur in the following files in the following order:

  • Strings.en-CA.lvres
  • Strings.en.lvres
  • Strings.lvres

By organizing resources properly, you can develop Longview Apps that will support multiple languages.

Syntax example

[[RESOURCE, "resourceBundle", "resourceKey"]]

where:

  • resourceBundle is the name of the resource bundle.
  • resourceKey is the name of the resource key.

Sample format of resource file

Syntax example 1

// Using a resource token in a Button in a Longview Form

Button "Update", "Text:[[RESOURCE, "Messages", "UpdateHeading"]] ", Validate:TRUE, "OnClick:button.lvpro"

Syntax example 2

// Using a resource token (with variables) in a Toolbar Action in a Longview Data View

ACTION "[[RESOURCE, "$source$", "$resourceKey$]]" ", "Image.png", "RUN PROCEDURE MyProc.lvpro", "This is help text"

Syntax example 3

// Using a resource token (with variables) in a SHOW MESSAGE command

SHOW MESSAGE "[[RESOURCE, "$source$", "$resourceKey$"]] "

Variables

A variable is a placeholder for dynamic data. There are different types of variables to support the storage of a single string value or list of string values, a single numeric value or list of numeric values, a list of symbol names, and a single object instance or list of object instances. You must first create your variable using the Create Variable command, assign a value to your variable using the Set Variable command, and then enclose your variable in $ $ to retrieve the value.

For object type variables, you can also assign values to its properties by using the Create Property command, followed by the Set Property command.

For more information on creating variables, see Create Variable.

For information on creating variables that you can use within any model or procedure called from your main procedure, see Create GlobalVariable.

In Longview Apps, you can pass variables between Longview Procedure and HTML documents by prefixing your variable with “LV_” in your HTML document.

For more information, see Passing variables between Longview Apps and Longview Application Framework.

Syntax example 1: For your Longview Apps procedure file

Create Variable EmpName as String Set Variable EmpName = “John Doe”

Show Message “Welcome $EmpName$!”

Syntax example 2: For your Longview Apps HTML file

<input id=“LV_EmpName” name=“EmpName” type=“text” /input>

Strings

Strings can be joined together through a process called concatenation. Concatenation is useful for joining two individual values to create combined values, or two-character strings to create a symbol name.

For example, suppose a complete account number in your system appears in the format A11234—consisting of a prefix code (A), followed by two digits (11) representing an entity code, followed by three digits (234) representing an account code.

You can combine any two of the elements by concatenating them. The concatenation provided by your system depends on the format of the source items:

Format of Sources Value of TargetSymName

If either of the sources contains a numeric value

Numeric source not used in concatenation.

If both sources contain numeric values

Resulting string remains unchanged.

Syntax

STRING 1 + STRING 2

Syntax example

CREATE VARIABLE StrTemp1 AS STRING

SET VARIABLE StrTemp1 = "aaaaa" + "bbbbb"

StrTemp1 will equal "aaaaabbbbb" (without the double quotation marks)

For an optimal Community experience, Please view on Desktop