Activating contexts
In order to use contexts in BI Point, you must edit the entries in the config.json file.
Default location: "C:\Program Files (x86)\Comarch\BI Point\instances\instance name\bipoint"
Flags:
Save the config.json file after making the above changes and restart the Comarch BI Point service for the changes to take effect.
IsReportContextEnable
IsReportContextCheckEnabled
Adding contexts
Contexts can only be added from a database level.
To add a new context, you need to execute the following scripts on a PostgreSQL BI Point database.
INSERT INTO rb."Contexts" ("CTX_Name") VALUES ('ContextName')
INSERT INTO rb."Parameters" ("PAR_Name") VALUES ('ParameterName')
INSERT INTO rb."ContextsParameters" ("CTP_ContextId","CPT_ParameterId") VALUES (1,1)
INSERT INTO [RB].[ContextsMappings]([CTM_ContextId],[CTM_ContextMapping],[CTM_MappingName])
VALUES (1,'ExternalContextName','ContextName')
After you execute the above code, the NewContext will be visible. The API will use the name ExternalContextName. You can optionally add translations for conexts:
INSERT INTO rb."ContextTranslations" ("CTL_Id", "CTL_ContextId", "CTL_LocaleId", "CTL_Translation") VALUES (1, 1, 'en-EN', 'Sale')
Defining contexts in Comarch BI Point
After you successfully activate contexts from the config.json file (as described in article Activating contexts) and add a context to the database (as described in article Adding contexts), you need to define contexts directly on the repository object.
To define a context, first select the appropriate object and then the "Add Context" button.
You can add multiple contexts to a single object if more than one context has been defined in the database.

Uwaga
Contexts cannot be added if the report, dashboard, or analysis is based on a data model that contains parameters.

- Context
- Filtered attribute
You can add multiple contexts to a single object if more than one context has been defined in the database.

Using contexts in Comarch BI Point
Using contexts
API methods must be executed directly after the BI Point instance, e.g. http://localhost:55555/api/ReportContext/GetContextReportsAvailable methods:
api/ReportContext/GetContextReports
api/ReportContext/GenerateLinks
Examples of how to use the methods
api/ReportContext/GetContextReports
1.Requests
- all context reports are requested.
{"data":"{}"}
- context reports assigned to the context "Product" are requested.
{"data":"{\"Contexts\":[{\"Name\":\"Product\"}]}"}
- context reports assigned to the context with id 20 are requested.
{"data":"{\"Contexts\":\[{\"Id\":20}\]}"}
- context reports assigned to the context "Product" or to the context with id 20 are requested.
{"data":"{\"Contexts\":[{\"Id\":20},{\"Name\":\"Product\"}]}"}
- all context reports available to the user with login "ab" are queried.
{"data":"{\"Users\":[{\"Login\":\"ab\"}]}"}
- all context reports available to the user with id 14 are queried.
{"data":"{\"Users\":[{\"Id\":14}]}"}
- all context reports available to the user with the login ab and to the user with id 14 are queried. Reports are grouped separately for each user.
{"data":"{\"Users\":[{\"Login\":\"ab\"},{\"Id\":14}]}"}
- context reports assigned to the contect with id 20 and grouped by the user with the login "ab" and id 14 are queried.
{"data":"{\"Users\":[{\"Login\":\"ab\"},{\"Id\":14}],\"Contexts\":[{\"Id\":20}]}"}
2.Responses
api/ReportContext/GenerateLinks
1.Requests
- a link to the report 37530 is requested
{"data":"{\"Id\":37530}"}
- a link to the report 37530 filtered to the element with a unique name (Type 0) in the context with id 20 is requested
{"data":"{\"Id\":37530,\"Contexts\":[{\"Id\":20,\"Members\":[{\"Type\":0,\"Value\":\"[Product].[Code].&[100010013]\"}]}]}"}
- a link to the report 37530 filtered to the element with a displayed name (Type 1) in the context with id 20 is requested
{"data":"{\"Id\":37530,\"Contexts\":[{\"Id\":20,\"Members\":[{\"Type\":1,\"Value\":\"KAR/0024/OP\"}]}]}"}
- a link to the report 37530 filtered to the element with OrgId (Type 2) in the context with id 20 is requested
{"data":"{\"Id\":37530,\"Contexts\":[{\"Id\":20,\"Members\":[{\"Type\":2,\"Value\":\"368:141\"}]}]}"}
- a link to the report 37530 filtered to the element with a unique name, displayed name and OrgId in the context with id 20 is requested
{"data":"{\"Id\":37530,\"Contexts\":[{\"Id\":20,\"Members\":[{\"Type\":0,\"Value\":\"[Product].[Code].&[100010013]\"},{\"Type\":1,\"Value\":\"KAR/0024/OP\"},{\"Type\":2,\"Value\":\"368:141\"}]}]}"}
- a link to the report 37530 filtered to the element with a displayed name in the context with id 12 and with a unique name, displayed name and OrgId in the context with id 20 is requested
{"data":"{\"Id\":37530,\"Contexts\":[{\"Id\":12,\"Members\":[{\"Type\":1,\"Value\":\"00111 test test DE-123123 Bayern\"}]},{\"Id\":20,\"Members\":[{\"Type\":0,\"Value\":\"[Product].[Code].&[100010013]\"},{\"Type\":1,\"Value\":\"KAR/0024/OP\"},{\"Type\":2,\"Value\":\"368:141\"}]}]}"}
2.Responses
