-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from exxeleron/develop
qXL tutorial added
- Loading branch information
Showing
30 changed files
with
444 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
### **Troubleshooting** | ||
|
||
<!---------------------------------------------------------------------------------------------------------------------> | ||
`Troubleshooting` document describes known problems and solutions encountered during usage of `qXL` COM add-in. | ||
|
||
> Note: | ||
> Please use our [google group](https://groups.google.com/d/forum/exxeleron) | ||
or open a [ticket](https://github.com/exxeleron/enterprise-components/issues) | ||
in case you enocounter any installation/startup problem which is not covered in this document. | ||
|
||
|
||
### Issue 1 - memory leak while using charts based on RTD data | ||
|
||
##### Problem | ||
It was observed that memory usage is constanly growing for Excel Workbooks which contain charts built dynamically based on the data from `RTD` formula. The increase in memory usage depends on the charts types and amount of data they require. | ||
The issue is caused by the memory leak for Excel charts with external data source. | ||
|
||
##### Solution | ||
Using charts with `RTD` data is generally not recommended. Open again the Workbook to free the memory. | ||
|
||
### Issue 2 - no data updates after calling `qRTDClose` and `qRTDOpen`. | ||
|
||
##### Problem | ||
In case of calling `qRTDClose` function the subscription is properly closed and the `RTD` formuls stops updating. However, calling `qRTDOpen` with the same alias again does not result in subsribing for new values. | ||
|
||
##### Solution | ||
Calling `qRTDOpen` with different alias refreshes the connection and results in subscribing for new values. | ||
|
||
### Issue 3 - stop of the display in the Excel after publishing process is stopped | ||
|
||
##### Problem | ||
In case of stopping the publishing `q` process to which Excel is subscribed the `RTD` formula values stop updating. Even after restrting the process the subscription is not automatically re-opened, values are not updating. | ||
|
||
##### Solution | ||
Calling `qRTDOpen` with different alias refreshes the connection and results in subscribing for new values. | ||
|
||
### Issue 4 - different display of `qQueryRange` and `qQuery` nested results. | ||
|
||
#####Problem | ||
Nested results (with more than two dimensions) are displayed differently in Excel in `qQuery` and `qQueryResult` formulas. | ||
Whenever we try to display something different than `q` atom in single cell `qQuery` prints `#VALUE` error and `qQueryRange` | ||
leaves the cell blank. | ||
|
||
Please see the example below: | ||
|
||
We query nested list which have atoms on all position except for the first element of the second row where there is another list. | ||
|
||
`qQuery` displays nested result as `#VALUE` error in Excel as can be seen below: | ||
|
||
![qQueryNested](../doc/img/qQueryNested.png) | ||
|
||
|
||
`qQueryRange` displays nested result as empty cell as can be seen below: | ||
|
||
|
||
![qQueryRangeNested](../doc/img/qQueryRangeNested.png) | ||
|
||
|
||
##### Solution | ||
|
||
To have the same display `qQuery` can be wrappred with `IFERROR` formula as can be seen below: | ||
|
||
![qQueryNestedAligned](../doc/img/qQueryNestedAligned.png) | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
|
||
[:arrow_forward:](../Lesson02/README.md) | ||
|
||
# **Lesson 1 - Opening a connection and running a query** | ||
|
||
<!---------------------------------------------------------------------------------------------------------------------> | ||
|
||
|
||
This tutorial only covers a subset of the available interface functions contained in qXL add-in. Please refer | ||
to `qXL` [documentation](../../Worksheet-Examples.md) for for a full description of all functions. | ||
|
||
## Goal of the lesson | ||
|
||
The goal of the lesson is to present basic functionalities of `qXL` | ||
|
||
- opening a connection | ||
- running a query from Worksheet | ||
|
||
You can download the Excel [Workbook](../Lesson01/Lesson01.xlsx) with the content of the lesson. | ||
|
||
<!---------------------------------------------------------------------------------------------------------------------> | ||
## Prerequisites | ||
|
||
Although this whole tutorial is built based on the assumption that `Exxeleron` | ||
[system](https://github.com/exxeleron/enterprise-components) is installed locally, it is possible to use with other | ||
systems. All parts of code which need amending will be explicitly mentioned. | ||
|
||
|
||
<!---------------------------------------------------------------------------------------------------------------------> | ||
## Opening connection | ||
|
||
To open a connection the `qOpen` formula needs to be called. It is described in details | ||
[here](../../doc/Worksheet-VBA-API-Functions.md#qOpen). | ||
|
||
We suggest to have a seperate Sheet in each Workbook which handles all connections (especially if there are multiple | ||
connections opened). It is more convenient to use Named Ranges for referring to connection details in `qOpen` ' | ||
function, as can be seen on the screen below. | ||
|
||
![qOpen](../Lesson01/img/qOpen.png) | ||
|
||
``` | ||
=qOpen(nrRdbAlas,nrRdbHost,nrRdbPort,nrRdbUser,nrRdbPassword) | ||
``` | ||
|
||
As we see on the screen we have two connections opened: | ||
- first allows to process process on port 17011, which corresponds to `core.rdb` component on `Exxeleron` system installed locally | ||
- second allows to process process on port 17050, which corresponds to `access.ap` component on `Exxeleron` system installed locally | ||
|
||
> Note | ||
> | ||
The configuration needs to be changed in case of a system different than `Exxeleron`. | ||
|
||
We also added check cell, which shows whether the connection is open (cell "G2"). The formula inside is simply | ||
`=A2=B2`, as properly opened connection returns the alias name. | ||
|
||
<!---------------------------------------------------------------------------------------------------------------------> | ||
|
||
##Querying from Excel | ||
|
||
The basic query function is `qQuery`. It is decribed in more detail | ||
[here](../../doc/Worksheet-VBA-API-Functions.md#qQuery). | ||
|
||
It takes the connection alias as the first argument and any `q` stament returning `q` object as the second. We use the already opened connection to `core.rdb` so we can query the process without using handles. In this example we use `q-sql` statement as the second argument. | ||
|
||
> Note | ||
> In case of the production system it is recommended not to query `core.rdb` directly, but to use the access point component. | ||
![queryResult](../Lesson01/img/qQueryResult.png) | ||
|
||
``` | ||
{=qQuery('kdb+ connection'!nrRdbConnection,A1)} | ||
``` | ||
|
||
As we can see in the Excel Formula Bar the result is returned as an Array Formula. All non scalar results of `qQuery` are | ||
returned this way. We can now run other queries by changing the content of the cell A1 only. The output range will be | ||
automatically rescaled to match new query result. | ||
|
||
<!---------------------------------------------------------------------------------------------------------------------> | ||
|
||
##Queries with paramaters | ||
|
||
Now we will present an example of calling a `qQuery` with multiple argument function being the secon `qQuery paramater. | ||
The [.example.ohlcVwap2](https://github.com/exxeleron/enterprise-components/tree/master/tutorial/Lesson04) function | ||
returns OHLC table based on following parameters: | ||
|
||
- sym - list of securities symbols | ||
- d - list of dates | ||
- sTime - start time | ||
- eTime - end time | ||
- binSize - number of seconds | ||
|
||
The function is defined on the `access.ap` component, so we use this alias as the first `qQuery` argument. | ||
We insert example values to Excel cells, as can be seen on the screen below using Named Ranges. | ||
|
||
![qOhlcResult](../Lesson01/img/qOHLCResult.png) | ||
|
||
``` | ||
{=qQuery('kdb+ connection'!nrApConnection,".example.ohlcVwap2",qList(nrSymbol,"s"),qList(nrDate,"d"),qAtom(nrStartTime,"t"),qAtom(nrEndTime,"t"),qAtom(nrTimeInterval,"i"))} | ||
``` | ||
|
||
For getting results, we again use `qQuery` function. This time we need to provide the list of arguments converted to | ||
proper `q` types. We use `qAtom` for converting scalars and `qList` for converting the list. Documentation of all | ||
convertion functions is available [here](../../Worksheet-VBA-API-Functions.md). | ||
|
||
`nrSymbol` Named Range formula is defined in the special way. It results in automatic expanding of the Named Range `nrSymbol` any time we add new symbol on the right side of the current range. We do the same for date. | ||
|
||
![qRangeFormula](../Lesson01/img/qRangeFormula.png) | ||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.