ITabHyperlink.Action

Syntax

Action: String;

Action: string;

Description

The Action property determines the action to be performed, when a hyperlink is activated.

Action Property value example
Open file "C:\Image.jpg"
The specified file will open.
Open link "http://www.example.com"
The specified address will open.
Open report sheet "=Sheet2"
Moving to the specified report sheet will be performed.
Show cell range "=a0:b3;d0:f3"
Positioning on the specified range will be performed.
Show object in the centre of the screen "#Sheet2!PrxChart1"
Positioning on a diagram on the second report sheet will be performed.
Open repository object "@Dim"
An object with «Dim» identifier will open.
Opening repository object with sending parameters "@Dim(STRING=a;INT=1;FLOAT=0.01;DATE=09.02.2021 00:00:00)"
An object with the Dim identifier and specified parameters will open.
Object parameters are sent in round brackets as follows: <parameter identifier>=<parameter value >, and are separated with a semicolon. A parameter value may take single and multiple values. A multiple value is specified in square brackets as an array: "@Dim(STRING=[q,e];INT=[1,2];FLOAT=[0.01,0.02];DATE=[09.02.2021 00:00:00,10.02.2021 00:00:00])"
Run procedure/function Depending on the file where the macro is implemented the path to the macro in this property is specified in the different ways:
  • A macro is implemented in the repository unit/form: <unit/form identifier>.<macro name>.

  • A macro is implemented in one of the repository assembly objects: <assembly identifier>.<macro name>.

  • A macro is implemented in one of the repository .NET assembly objects: <.NET assembly namespace>.<class name>.<macro name>.

JS function and Fore function can be specified in macros together. JS function will be executed only in viewing web application and Fore function will be executed on viewing in the Foresight Analytics Platform:

  • Fore:<OBJ3331.MyFunc>. The desktop application will execute the MyFunc function contained in the unit with the OBJ3331 identifier.

  • Javascript:<alert("JavaScript Function")>. The web application will execute the JS function outputting the JavaScript Function message.

JS-function signature:

function <Function name>(custom parameters, args)

{

}

The example of function:

function testHyperlink(type, args)

{

debugger;

console.log(type);

console.log(args);

}

When a hyperlink is used, data entry forms may return parameters as arguments may be returned:

  • Report. Parameter for managing a report;

  • DataEntryForm. Parameter for managing a data entry form.

  • DataArea. Parameter for managing a table area.

The example of function used in a data entry form:

function addAttachmentsTB(row, col, args)

{

           var rep = args.Report

           var da = args.DataArea

           var grid = da.getGridView();

           var tabSheet = grid.getTabSheet();

           var tabSheetRange = tabSheet.getCell(row, col);

           attachFile(da, tabSheetRange);

}

Implementation of user macros in the units and forms of the repository is to be performed in the global namespace (Global Scope).
Implementation of user macros in the .NET units and .Net forms of the repository is to be performed within a class. A macro is to be a  static procedure or function.
"OBJ34114.MyFunction"
The MyFunction function will be executed, that is contained in the unit with the OBJ34114 identifier.

Example

In this example we suppose that an object Report of the type IPrxReport exists.

Add links to the Report, Tab system assemblies.

Sub UserProc;
Var
    Rep: IPrxReport;
    Tab: ITabSheet;
    Range: ITabRange;
    Hyperlink: ITabHyperlink;
Begin
    Tab := Rep.ActiveSheet.Table;
    Range := Tab.Cell(
00);
    Hyperlink := Range.Style.Hyperlink;
    Hyperlink.Action := 
"=Sheet2";
    Hyperlink.Enable := TriState.OnOption;
    Hyperlink.SeparateLinkText := TriState.OnOption;
    Hyperlink.Text := 
"Go to Sheet2";
End Sub UserProc;

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.ForeSystem;

Private Sub UserProc();
Var
    Rep: IPrxReport;
    Tab: ITabSheet;
    Range: ITabRange;
    Hyperlink: ITabHyperlink;
Begin
    Tab := Rep.ActiveSheet.Table;
    Range := Tab.Cell[
00];
    Hyperlink := Range.Style.Hyperlink;
    Hyperlink.Action := 
"=Sheet2";
    Hyperlink.Enable := TriState.tsOnOption;
    Hyperlink.SeparateLinkText := TriState.tsOnOption;
    Hyperlink.Text := 
"Go to Sheet2";
End Sub

As a result, the «A0» cell of the regular report a hyperlink with the text "Go to Sheet2" will be created, clicking on which will result in going to "Sheet2".

See also:

ITabHyperlink