Importing a library
Once you've saved a library of blocks, you will eventually want to reuse the code.
To see how this is done, first here's a sample <library>:
<library>
<block name="storeSelection" storechoice="1">
<sel value="store={@storechoice}"/>
</block>
</library>
The above library has been saved as a Quick Query to pub.demo.retail.selectionlib.
There are two steps to making a <block>
available in your current query. First, in order to use a block stored in a library you must
import the library using the <import> operation. To do this, simply provide the path to your
library in the path attribute.
The second step is to call any <block> in the imported library by
referencing its name. This is done in the <insert>, <expand>, or <call> operations.
The following code shows both steps: importing the library
pub.demo.retail.selectionlib, and then calling the block
StoreSelection within the library.
<base table="pub.demo.retail.item"/>
<import path="pub.demo.retail.selectionlib"/>
<insert block="storeSelection"/>
This code returns records for the selection store=1, because the default
value for the variable storechoice is 1.
See the following section, Inserting a block, for more information.
<import> step in your query.
See Specify automatically imported libraries in the
1010data Insights Platform User's Guide for more information.